Repository navigation
fix: harden async lifecycle and CI test contracts - #26546
Conversation
Code Review by Qodo
1. Flock not closed on error
|
PR Summary by QodoHarden async lifecycle contracts (checkpoint GC, embed clusters, ISCP/MORPC tests)
AI Description
Diagram
High-Level Assessment
Files changed (30)
|
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep review completed at d2d841e. One production-reachable data-correctness blocker is reported inline: the new ForceGCKP fast path treats durable coverage as if it also satisfied the caller-specific history-retention contract, allowing the administrative ForceGC path to fail open. The remaining checkpoint durable-boundary/predecessor changes, embed lease lifecycle, ISCP/MORPC synchronization, JSON_OVERLAPS extraction, and test migrations did not reveal another blocker. The reported gofrs/flock TryLock FD leak does not apply to the pinned v0.8.1 implementation because unheld handles are closed by ensureFhState on every error path. Targeted checkpoint, MORPC, and JSON tests passed. CI coverage and BVT passed; the Ubuntu UT job failed in the untouched logservicedriver TestReplay1 due a reused Dragonboat data directory/NodeHostID mismatch.
|
Deep review findings on exact head [P1] Do not let a pending GCKP become the table-ID predecessor of the next ICKPThe new fail-closed validation in This permits the following normal scheduling sequence:
This is deterministic, not a hypothetical race. Local normal/race runs of The CI timeline also confirms the overlap: the first GCKP ran from Please only accept a finished global checkpoint with authoritative table-ID history. If the exact-end global is pending, empty, unreadable, or lacks a valid coverage row, fall back to the finished ICKP ending at Relevant code: [P1] The gossip-port collision test does not reserve memberlist's wildcard address on Darwin
I reproduced this independently and in the package run: Please reserve Relevant test: [P2] Preserve a cleanup owner when startup rollback also fails
Please retain a retryable owner until cleanup succeeds; joining the cleanup error and returning a nil handle does not close the ownership lifecycle. Relevant code: I also rechecked the earlier checkpoint review threads: the force-retention, legacy-index authority, durable fallback, and multi-block coverage issues are fixed in this head. The reported |
|
已在 本轮对 review findings 的处理:
验证(最终 head / 最新 main):
关联 #26526。 |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
@LeftHandCold @aunjgr @gouhongshen @aptend @jiangxinmeng1 @volgariver6 麻烦 review 最新 head |
LeftHandCold
left a comment
There was a problem hiding this comment.
Re-review completed at exact head 0cc789a.
The previous production correctness blocker is closed: an ICKP now selects only a finished, boundary-adjacent predecessor; current-format GCKP metadata must prove continuous table-ID history, pending GCKP intents are excluded, and legacy/global-only recovery rebuilds an explicit partial range while GCKP publication remains fail-closed until the retention window is authoritative. Changed-table consumers validate both history bounds.
I also rechecked the zero/idle-LSN WAL path, checkpoint replay, catalog-GC boundary, embedded-cluster cleanup ownership, startup/port lease retries, Darwin raft-port collision test, fault-barrier cleanup, and final main merge. No further production-reachable correctness, regression, resource-lifecycle, or performance blocker was found.
Focused tests passed for checkpoint predecessor/retention, table-ID gap and multi-block consumption, changed-list bounds, pending-GCKP concurrency, legacy/global-only GC, zero-LSN and fully-reserved WAL restart, cluster cleanup-owner retries, and stable-identity port collision. The normal Ubuntu UT job is green. The coverage run had one TestBasicCluster TN-ready timeout under instrumentation; based on the passing normal UT and the reviewed state machine, I do not consider that single flake a code-review blocker.
|
Follow-up for the new UT Coverage failure ( |
|
@ck89119 please help to review |
XuPeng-SH
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES-equivalent review at exact head 24cd00a. GitHub does not allow the PR author account to formally request changes on its own PR.
[Blocker][SCA] Replace both newly added production fmt.Errorf calls with moerr.
- pkg/vm/engine/tae/logtail/ckp_writer.go:870 constructs the table-ID predecessor continuity error with fmt.Errorf.
- pkg/vm/engine/tae/db/db.go:276 constructs the exhausted fresh-ICKP retry error with fmt.Errorf and wraps ErrGCKPNeedsFreshICKP.
The repository err-check scans non-test files under pkg and rejects fmt.Errorf. Exact-head make err-check fails deterministically, and the arm64 SCA job is now failed. Please use context-aware moerr construction at both sites; where preserving errors.Is identity is intentional, combine the moerr context with the original cause via errors.Join or the repository equivalent.
The rest of the production closure is sound in this head: only finished checkpoints advance durable/GC boundaries; forced GCKP requests reserve a real ICKP, merge with maximum requested retention, receive their exact execution result, retry with bounded cancelable backoff, and hand suppressed automatic work back; table-ID history remains fail-closed across GC/restart/legacy gaps; embed port/startup/service ownership has retryable terminal cleanup; retry metrics have three fixed reasons. No additional correctness, resource-lifecycle, compatibility, or hot-path performance blocker was found.
Fresh local evidence: the five checkpoint state-machine tests passed under race 100x each; embed heartbeat contract 100x; table-ID single-pass validation 100x; real force-GC-fresh-ICKP lifecycle 50x; legacy/partial-history fail-closed 49x; full checkpoint and logtail packages passed race count=1. The PR head remained unchanged throughout review.
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE-equivalent review at exact head 38c61ef. GitHub does not allow the PR author account to formally approve its own PR.
The prior SCA blocker is closed. Both new production fmt.Errorf sites now use context-aware moerr construction, and the exhausted fresh-ICKP retry uses errors.Join so errors.Is still reaches ErrGCKPNeedsFreshICKP while preserving the contextual MO error. Exact-head make err-check passes.
I re-reviewed the complete 43-file diff rather than only the two-line fix. No remaining merge blocker was found:
- Correctness/closure: only finished checkpoints advance durable, catalog-GC, logtail-GC, and snapshot boundaries; forced GCKP has an exact result, fresh finished ICKP predecessor, maximum merged retention, bounded retry, and suppressed automatic-work handback; table-ID history stays fail-closed across pending GCKP, GC, restart, legacy metadata, partial ranges, malformed coverage, and multi-block readers.
- Unhappy paths: checkpoint intents and embedded services/leases retain exactly one cleanup owner; waits observe caller/runner cancellation or a hard timeout; queues, retries, port ranges, sinkers, and metric labels are bounded.
- Performance/compatibility: no query hot path is changed. The table-ID merge remains single-pass and now releases each batch promptly; extra retries occur only on rare forced-checkpoint contention. No disk/wire format change is introduced; legacy checkpoints recover conservatively without mandatory conversion.
- Observability: force-checkpoint logs include requested/checkpoint TS, retention, retry counts, and errors; the retry counter has three fixed reasons.
Fresh exact-head evidence: modified production packages build and vet; focused selection is non-empty; TestForceGCKPRequiresFreshICKPAfterGlobal, TestSyncTableIDBatchValidatesPredecessorInSinglePass, and TestForceGCKPRetryBackoffIsBoundedAndCancelable each pass under -race -count=100 (T=0/0.02/0s, B=30s, N=100); full db, checkpoint, and logtail packages pass both race and normal count=1. All four inline review threads are resolved. GitHub SCA/UT/coverage/BVT jobs were still running when this review was submitted; no CI failure was present.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of 38c61efbc81f9e7939db79c0c6cc56954019f479 against 06004087353d58094c14080cc122e5681ed590d0. This is a blocking review; GitHub does not allow the PR author to submit REQUEST_CHANGES on their own PR.
I found two confirmed blockers: an unbounded object-ownership gap on failed GCKP publication, and the unchanged coverage-sensitive allocation oracle from #26543. Both have inline details and local reproduction evidence below.
Validation performed on the exact clean head:
- reproduced the GCKP orphan growth with the existing fail-closed integration scenario: 5 failed attempts produced 5 unreachable table-ID objects; the temporary diagnostic patch was removed
- exact allocation test under repo-wide
-coverpkg=./...: 20x; full function package under the same instrumentation: 10x (passes locally, but proves the test still participates in coverage) - full
-race -count=1suites: checkpoint, logtail, TAE DB, MORPC, embed, logservice, and SQL function - adaptive race stress: history fallback/fail-closed 29x; repeated force->GCKP->GC lifecycle 34x; fast checkpoint/logtail/embed/MORPC/logservice/JSON invariants 100x; affected ISCP success and unhappy paths 4x-37x according to measured duration
No additional confirmed blocker emerged from the lifecycle, wait-for, retry/cancellation, port-lease, ISCP, or plan/performance audit.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-review after 5480ada and the latest main merge: the two previously blocking findings are closed, and I found no remaining blocking correctness issue in the updated diff.
The checkpoint fix now follows one publication invariant across both ICKP and GCKP: successful sinker writes have exactly one owner until durable checkpoint metadata exists. Internal sinker failures roll back partial spills; explicit failures after helper success roll back checkpoint-data and table-ID objects. Cleanup is deduplicated, bounded per 1,000-object batch, preserves both error chains, and adds fields to the existing aggregate checkpoint error event rather than emitting per-file logs. The normal success path performs no delete, deduplication, or file listing.
The coverage-sensitive AllocsPerRun oracle is removed rather than weakened. Its intended contract remains covered deterministically by stable wrapper identity plus a real 8,192-row result verification under race and repo-wide coverage instrumentation.
Unhappy-path evidence includes partial spill before validation failure, injected cleanup failure, failed ICKP/GCKP metadata publication, repeated fail-closed GCKP attempts, parent cancellation, and the 1,000/1 batching boundary. Final adaptive race repetitions (14x/5x/16x), complete owning-package race suites, targeted and repo-wide coverage, build, vet, gofmt, and diff checks all pass locally.
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE-equivalent review for exact head c1ca6ec (GitHub does not allow the PR author to formally approve their own PR).
Re-reviewed the complete 43-file diff, the latest cleanup-error delta, all six review threads, and the relevant producer/consumer and failure paths. I found no remaining blocking issue.
- Correctness/lifecycle: checkpoint publication remains the linearization point; pre-publication ICKP/GCKP data and table-ID objects are rollback-owned, cleanup is bounded/deduplicated/cancelable, and the original error remains reachable through errors.Join. Embedded-cluster service/lease ownership is retained until cleanup succeeds, including partial startup and added-CN rollback.
- Completeness/compatibility: forced GCKP keeps a finished fresh ICKP predecessor and requested retention; legacy/missing table-ID history fails closed and restarts from a real boundary without a disk/wire-format change. All review threads are resolved.
- Performance/design: added work is confined to checkpoint/test lifecycle paths; the JSON hot path still uses result-scoped wrappers, fixed-label retry metrics are low-cardinality, and there is no new non-spill/query hot-path cost.
- Observability: retry reason counters and retry counts are bounded/fixed; rollback object count and cleanup error are preserved separately in logs.
Exact-head validation passed:
- git diff --check, gofmt -d, make err-check
- go vet for all modified production owner packages
- focused normal and -race tests for embed leases/rollback, checkpoint cleanup/table-ID/forced-GCKP, logservice retry identity, and JSON wrapper reuse
- real ICKP/GCKP save-failure tests proving the file-service object snapshot is unchanged after failed publication and recovery succeeds after fault removal
Completed CI checks are green with no failures observed; the still-running UT/SCA/coverage/CodeQL/BVT jobs remain the merge gate.
What changed
This fixes the shared asynchronous lifecycle contracts behind the recent CI flakes instead of relaxing individual assertions:
mo_task_checkpoint_retry_totalexposes three fixed reasons without dynamic label cardinalityNo test sleeps, skips, race exclusions, reduced row/cardinality assertions, or raised allocation thresholds were introduced. Normal checkpoint publication does not perform cleanup scans or file-service calls; deduplication, batching, and rollback logs run only after an explicit pre-publication failure.
Validation
make static-check(package graph, err-check, molint, license checks, golangci-lint): 0 issuestae/db/test, metric, partition, and shard-racecheckpoint/logtail/TAE DB/metric packages and fulltae/db/test; partition and shard also pass their complete race suitesobjectio/ioutil, logtail, checkpoint,tae/db/test(114.604s), and SQL function (38.262s)objectio/ioutil, logtail, and checkpoint; JSON passes with repo-wide-coverpkg=./...go build,go vet,gofmt, and full-PRgit diff --checkpassFixes #26519
Fixes #26529
Fixes #26530
Fixes #26542
Fixes #26543
Fixes #26544
Fixes #26545