Repository navigation
fix(iscp): preserve initialization lifecycle atomically - #28176
Conversation
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? |
e9093e3 to
804a7b8
Compare
|
Deep review result for Implementation verdict: no code-level blocker found; approvable after the independent design gate is satisfied. I traced the complete lifecycle through registration, startup repair/replay, candidate admission, InitSQL, ordinary consumption, maintenance watermark flushes, retry/CAS loss, cancellation, commit ambiguity, job recreation, and multi-CN ownership handoff. Key conclusions:
The remaining merge gate is the design artifact itself: it still says Status: Review required. An independent owner must explicitly accept the fail-closed migration behavior and the real rollout prerequisite that ISCP ownership must not return to an old CN after versioned state exists (or the protocol must be backported to every eligible owner). That condition is documented but intentionally not enforced by this code. The authenticated GitHub user is also the PR author ( |
LeftHandCold
left a comment
There was a problem hiding this comment.
Reviewed exact head cfea7c8. No blocking correctness, availability, performance, or lifecycle issue found.
I independently accept design revision 2, including the conservative fail-closed treatment of unversioned Completed/Init rows with InitSQL. I also accept the documented rollout invariant as a release/operations gate: once versioned lifecycle state can be written, every CN eligible to own ISCP must understand this protocol, or ownership must be pinned so it cannot return to an old CN.
The implementation closes the original failure mode: InitSQL effects and the Running lifecycle marker commit atomically; exact job generation plus previous-LSN CAS fences stale or ambiguous writers; maintenance advances watermark in place and cannot erase or regress Stage/LifecycleVersion; restart rebuilds from durable state and quarantines genuinely ambiguous legacy rows. CAS losers, commit/rollback failures, cancellation, worker generation shutdown, and partial multi-job watermark flushes retain bounded and observable behavior.
Q1 cleanup ownership: pass. Transactions, results, workers, consumers, and flush reservations have one effective cleanup/reconciliation path.
Q2 bounded waits: pass. Iterations, catalog operations, retry budgets, transaction finish, worker stop, and consumer drains are canceled or time-bounded.
Q3 bounded growth: pass. Worker concurrency and queue capacity are fixed; startup scan is bounded by the catalog job set and a five-minute context; no per-source-row hot-path growth was added.
Validation evidence at this exact head is green: Ubuntu x86 UT, coverage, arm64 SCA, build, proxy multi-CN BVT, and pessimistic multi-CN BVT. The original vector_ivf_async.sql scenario ran 39/39 successfully in the pessimistic multi-CN job. The branch is behind main but the intervening main changes do not overlap this PRs files.
What this fixes
Closes #28175.
The periodic ISCP watermark flush rebuilt
JobStatusfrom only the next LSN. BecauseStage=Initis the zero value, an initialized async-index job could regress fromRunningtoInit; a later iteration could execute non-idempotent initialization again and make derived index metadata inconsistent.The fix now closes both the current write bug and the cross-restart/cross-version lifecycle holes rather than recognizing one observed row shape.
Design artifact
Atomic ISCP initialization lifecycle is the R3 design artifact. Its status remains Review required until an independent owner approves the lifecycle and rollout contract.
First-principles invariant
For one
(account_id, table_id, job_name, job_id)generation:InitSQLeffects andStage=Running/LSN/lifecycle evidence have one commit point;Implementation
JSON_SET, preserving stage, errors, lifecycle evidence, and future fields.max(durable Stage, incoming Stage)andmax(durable LifecycleVersion, incoming LifecycleVersion).InitSQLand theRunningtransition execute in one transaction.LifecycleVersion=1withRunning. An Init error writes the same evidence only through the old-LSN CAS; if Commit actually succeeded, the advanced LSN makes that compensating write lose.Completed/Initjob withInitSQL, includingLSN=0, advanced-LSN, and retry/error variants. Old code can leave all of those shapes after InitSQL already committed, so none is safe evidence for re-execution.Upgrade and unhappy paths
Performance and risk
Validation
pkg/cdcandpkg/iscptests passed with the repository CGo harness.-race -count=10.LSN=0, advanced LSN, retry message, error code, normalized Pending/Running, terminal state, no-InitSQL, versioned atomic retry, marker preservation, and future-version monotonicity.make err-checkandgit diff --checkpassed.The design still requires independent approval. This update is pushed without waiting for CI.