Repository navigation
fix(frontend): preserve primary-key moves as native updates in DATA BRANCH apply - #31629
gouhongshen wants to merge 28 commits into
Conversation
d3a8a2f to
b3e67ca
Compare
b3e67ca to
e686d10
Compare
e686d10 to
63d8b07
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f1f029afe259bc9405e435a5cecde2d743a39623
Assessment: approve
The allocation regression from review 5731977129 is resolved. Per-call encoder binding preserves encoding and vector-lifetime contracts. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Verified frozen head/base and clean source; independently reviewed the two-file delta and confirmed 149 paths unchanged from the prior review.
-
Reconciled all 59 discussion keys. Audit passed: source-audit-final.log; checks/1793608421382697035-2.json.
-
Current-head CI reports 14 successful, 14 skipped and 2 neutral checks, including successful build, UT, SCA and both multi-CN BVT checks.
-
Reused qualified prior coverage and assessed the author's focused regression and paired benchmark reports.
Limitations:
-
No fresh runtime tests or benchmarks; historical execution and CI raw logs were not supplied. Upgrade CI was skipped.
-
Previously accepted live-table provenance-GC and stable-key/delete sibling follow-ups remain outside the accepted scope.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Follow-up review at head f1f029a; the range 438b247..HEAD is a single non-merge perf commit confined to pkg/frontend/databranchutils/branch_hashmap.go and its test, and the broader origin/main...HEAD diff was read in prior passes of this session. The only blocker outstanding at my prior reviewed head (the P2 per-cell encoder allocation in the unconverted hash-map loops, mo-bot review 5731977129) is fixed and verified: new bindRowEncoders binds one vector.RowEncoder per selected column before the row loops in PutByVectors, PopByVectorsStream and lookupByVectors, and GetByVectors delegates to the converted lookup, eliminating the per-cell closure allocations. Byte format is preserved by construction because the scalar and bound paths execute the identical NewRowEncoder dispatch with the type switch hoisted out of the loop, const-row clamping still matches GetFixedAtNoTypeCheck's index-0 semantics, and dropping the loop error checks changes no behavior since EncodeRowToPacker has returned a statically nil error since head 438b247. Every remaining production loop (frontend hashdiff/pick, multi_update link emission, disttae fixup) binds once per vector, and the single scalar use left in notePkMoveDivertedDeleteLocked is a genuine one-row encode per the API contract. Evidence from this checkout with its documented CGO setup: make cgo built the native artifacts (recorded exit 0), pkg/frontend/databranchutils 142 PASS / 0 FAIL including TestBindRowEncodersMatchEncodeRow and the spilled and roundtrip suites, pkg/container/vector 333 PASS / 0 FAIL including TestNewRowEncoderMatchesEncodeRowToPacker and TestNewRowEncoderConstVector, and 8 focused pkg/frontend apply-path drivers all PASS; gofmt clean. All previously blocking topics from earlier rounds are fixed and confirmed present at this head: victim delete ordering before the I4 zero-match guard, subscription provenance owner identity, prepared-UPDATE retentionSource per-execution rebind, historical-owner probe at the transition snapshot, compact retained-delete PK vector, removed per-feature upgrade gates on the frozen 4.0.7 vehicle (offset 43) with fresh-vs-upgrade catalog DDL identity via shared constants, and fengttt's two requests, which are answered by the fix-strategy writeup now opening the PR body and by the end-to-end vectorized key encoding; the two new mo_catalog tables' user-visible result updates (table count 61 to 63 and appended listing rows) match the updated expected results. The independent mo-bot review of this same head reached the same conclusion (approve, allocation regression resolved, no actionable findings). Limitations: author-reported before/after benchmarks were not independently re-run (the structural elimination of per-cell closures plus the green suites is the basis), and the broader multi_update/disttae suites and BVT SQL batteries were not re-run locally this round because the delta is confined to two files; those rest on prior same-patch evidence and CI. Three documentation-level P2s raised by the earlier Codex review at 8c573bb remain open and are recorded here only to avoid duplication: pkg/frontend/predefined.go:440 still names the deleted pkg/bootstrap/versions/v4_0_19 package in its DDL comment, the vehicle-attribution sentence near docs/design/20261016-data-branch-pk-move-update-provenance.md:580, and docs/design/20261028-catalog-upgrade-407.md lines 9 and 73 still asserting the superseded 27+14 entries at offset 41. Nothing blocking remains from my prior reviews or from this inspection, so the verdict is approval with no findings.
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed the current r105 design/decision register and its exact-revision independent design approval; that earlier design-approval blocker is closed. Traced provenance probe/merge, per-generation collection bounds, resolution, and apply failure behavior. Found a remaining executable snapshot-isolation defect: out-of-window ancestor commits can poison a valid child anchor before commit-window filtering. Details and a deterministic branch/transaction schedule are inline. This is a source-path review finding, not a claim of a complete fresh implementation audit or locally executed reproduction.
| if !samePkMoveLinkIdentity(prev, link) { | ||
| // Two tables claim different lineage for the same | ||
| // (row id, old pk): the stream row this key pairs with is | ||
| // not attributable, so the anchor poisons (fail closed). |
There was a problem hiding this comment.
[P2] Exclude out-of-window commits before poisoning shared row identities
The SQL probe uses write_ts <= window.endPhys, but write_ts is the transaction's CREATE time, not its commit time, and the catalog query reads the current statement snapshot. Therefore it can return an ancestor's move committed AFTER that ancestor window ended. mergeProbedLinksLocked discards the physical-table/window identity and poisons (oldRowID, oldPK) immediately, before the stream-commit membership checks can exclude that move.
A concrete supported schedule is: persist row (1, ...) in parent P; fork destination D at t10; begin transaction X on P at t20; fork source S from P at t30; X updates P's 1 -> 2 and commits at t40; S updates its inherited 1 -> 3 and commits at t50. Merge S into unchanged D. The source lineage contains P through t30 and S after t30. P's link passes write_ts=t20 <= t30, although its commit t40 is outside the P segment. Since the clone inherits the persisted row identity, P's and S's links have the same (oldRowID, oldPK) but different successors/transaction identities. This loop poisons S's valid anchor, byRowProbeVerdict returns incomplete, and resolveAndBuildPkMoveFolds aborts a conflict-free merge instead of applying 1 -> 3.
Keep per-window attribution until actual commit membership is established (or snapshot-anchor each window's catalog read at its full endpoint), and only then merge/conflict-check relevant links. Add a multi-generation/sibling-branch regression with a transaction begun before the fork but writing/committing after it. This is different from legitimately ambiguous in-window provenance: the competing link here must be invisible to this source lineage.
There was a problem hiding this comment.
Confirmed — the schedule is real and the defect reproduces exactly as described. I built the two-window fabric (P segment [10,30] on table 88, S segment [30,50] on table 99) with X's link (oldRowID R, 1->2, write_ts=20, committed after t30) admitted through the P-window probe and Y's in-window link (R, 1->3, write_ts=35) through the S-window probe: byRowProbeVerdict returns hit=false, complete=false, poisoned=true, so the walk resolves pkMoveUnresolved and the apply aborts a conflict-free merge. The poisoning fires before any commit-membership screening, exactly as traced.
Classification: valid bug, in scope. Every manifestation is a fail-closed abort (the D51 unresolved-verdict route; birth-certificate binding bars a misattributed fold), so there is no wrong-data exposure.
Repair (design revision r106, new decision D223, commit 367c154 on this branch): every provider-window catalog read — the whole-window scan, the per-key overflow fallback, and the LIMIT-1 existence probe — is snapshot-anchored at the window's full end timestamp via {MO_TS = '<phys-logical TS>'} (the D222 anchor form), so each probe exposes exactly the links committed at or before its window's end and X's t40 commit is invisible to the P window anchored at t30. The missing lower bound on write_ts stays: a transaction created before the window start but committed inside it remains visible at the anchor. Sufficiency without per-window cache attribution: the link_id prefix range already restricts each probe to the window's physical table, and on a linear lineage an in-window move retires its (row id, old pk) occupant from every descendant's inherited state, so after anchoring two different visible links can share one row identity only through genuinely ambiguous catalog evidence — the poisoning path stays fail-closed for exactly that case. A window whose end predates the link catalog's creation in its owner account degrades to complete absence for that window (anchored mo_tables {MO_TS = window.end} existence check, extending D220 (B.4)); empty-end fixtures keep the unanchored posture; the PICK key-closure probes keep the wider unanchored read because over-admission there only widens the dependency-key set while every fold decision stays behind the anchored, membership-screened walk.
Per the repository design gate this changes documented decisions (the D11/D24 bounds), so implementation waits for independent design approval of r106; the regression you asked for — a multi-generation/sibling fabric UT with a transaction begun before the fork but writing/committing after it, plus anchored-SQL assertions and a live sibling-branch BVT — lands with the fix. I will update this thread once they are in.
There was a problem hiding this comment.
Design-review update on the r106 repair submitted above: the independent design review returned REQUEST_CHANGES (P2). D223's {MO_TS = window.end} anchored reads of the link catalog require retained historical storage versions that nothing protects — TN's all-snapshot protection covers only the three core catalog tables, table-level snapshots propagate only to non-system tables of the same database (system tables are skipped), and the mo_catalog PITR channel carries only user-created PITRs — so catalog-object rewriting and reclamation could delete the very version an anchored read queries while the logical links stay live. No CN-expressible protection channel exists, and adding one in TN is out of this PR's scope. r106 was never implemented.
Design revision r107 is now on this branch (366934c7fc, doc MD5 5fbaf365635abc61d9a66e09f72448d9): D223 withdrawn, new decision D224 adopts your first option — per-(table, window) attribution of probed links with conflict checking deferred until the D156 scope-to-commit capture establishes commit membership. The straddler's link (created in-window, committed after) is excluded before identities compare, so it can neither bind nor poison the child's anchor; only membership-admitted candidates enter the identity comparison, and genuinely ambiguous in-window duplicates still fail closed. No provenance verdict depends on reconstructing a historical catalog state anymore. Section 9.3 gained the storage-version retention audit and section 10 the lifecycle scenario (table-scoped protection only, catalog rewriting/reclamation, restart, exact MERGE/PICK cascade assertions).
r107 is submitted for fresh independent design approval; implementation, including the multi-generation/sibling regression you asked for, follows that approval. Leaving this thread open until then.
There was a problem hiding this comment.
Disposition update (2026-11-02): this finding's repair lineage is now r108 / D225 (6a31f5197f, docs/design/20261016-data-branch-pk-move-update-provenance.md, doc content MD5 d92a3043d0048b73cc15e5fbeb3bc2ab), superseding r107/D224 before implementation. The independent design review of r107 confirmed two blockers in the membership-screening approach and both are now removed at the design level:
- The singleton exemption (a single membership-unscreened candidate could start/resolve a chain) is gone. r108 stores each link's recording-transaction commit instant in a new
commit_ts binary(12) nullcolumn (fulltypes.TS, stamped CN-side at commit completion by link id) and admits a candidate at a departure instant T only when its storedcommit_tsequals T. Exact-transaction binding, no exemption. On your schedule, X's link commits at t40 while the anchor tombstone's departure instant is t50, so X's link is excluded before any identity comparison — it can neither bind nor poison. With zero admissible candidates, S's independent DELETE+INSERT keeps plain DELETE replay semantics. - The membership capture's dependency on unprotected catalog change history is gone. Commit membership is subsumed by the commit-exact gate (the admitted instant is a collected stream entry by construction), so the D156 scope-to-commit change-stream capture is retired from every resolution path. No resolution reader depends on reclaimable catalog history; the link rows live exactly as long as the protected stream (D13), and the lifecycle oracle is restored to exact MERGE/PICK cascade assertions after catalog rewriting/reclamation and restart. Loud aborts remain only for genuinely incomplete evidence (an unstamped
commit_tsmeans unprovable provenance and takes the D51/D56 abort — never a wrong fold, never a silent legacy downgrade).
Per the repository design gate, implementation — including the singleton-straddler + independent DELETE/INSERT MERGE/PICK regression the review demanded and the multi-generation/sibling straddler battery — waits for independent design approval of r108. The PR body carries the same record.
There was a problem hiding this comment.
Disposition update on this thread's finding (design checkpoint r108 -> r109).
Status of the repair for the out-of-window straddler poison: design revision r108 (D225, commit 6a31f5197f) repaired it by commit-exact admission — a candidate starts or continues a chain only when its stored commit_ts equals the departure tombstone's instant, so the straddler (created before the fork, committed after its lineage window ended) is excluded before any identity comparison and can neither bind nor poison an anchor. The independent design review of r108 then verified the repair's direction but returned REQUEST_CHANGES on two hardenings, both verified valid:
- (P1) Equality alone does not establish window membership. Windows are relation-specific, and one RC transaction begun before the fork (per-statement snapshot advance) can perform the ancestor move AND the sibling's independent DELETE/INSERT in a single commit; the ancestor link's
commit_tsthen equals the sibling anchor's departure instant while lying outside its own window, so an equality-only gate could still admit it. - (P2) A stamping failure/cancellation/crash/lost commit response left
commit_tsNULL permanently, and r108 made that state abort forever, stranding an otherwise valid committed branch; the COMMIT-result semantics were unclosed.
Design revision r109 (D226, commit 21a42804a3; doc content MD5 f6698dc5b4a1151fa244dce6712db387) answers both before implementation: per-(table, window) candidate attribution is restored and admission requires the candidate's commit_ts to fall INSIDE its own attributed window in addition to equalling the departure instant (checked before identity comparison or arrival attribution); and NULL becomes a durable stamp-pending intent healed lazily from the protected user-table stream (the linked row version dies exactly once; I7 ties the link to that commit), with same-transaction inheritance for placeholder chains, a best-effort re-stamp, and a closed COMMIT-result rule (stamping never alters the user transaction's own outcome; rollback leaves no provenance).
The multi-generation/sibling regression this thread demanded — a transaction begun before the fork but writing/committing after it — is in the section 10 validation map in both forms (the two-transaction straddler and the one-transaction ancestor-move + sibling DELETE/INSERT schedule), for MERGE and PICK, asserting DELETE semantics, FK implicit-RESTRICT rejection, and unchanged destination parent/child rows. Per the repository design gate, implementation waits for fresh independent design approval of r109; the PR body carries the full r108-outcome + r109 ledger entry.
There was a problem hiding this comment.
Design-checkpoint update (2026-11-02): the independent design review of r111 returned REQUEST_CHANGES on one new finding beyond this thread's straddler repair — (P2) r111's recorded cycle guard rejected every pairing-followed hop landing on a previously visited key, but D228 itself pairs the two links of a one-transaction 2->3->2 return, so the guard aborted the proven same-transaction homecoming that retained D70 requires to resolve. Verified valid against the reviewed revision: the shipped parser rejects only strictly backward birth certificates and continues equal-certificate homecomings (pkg/frontend/data_branch_pk_move_link.go:3148-3161, :3173-3178), and the shipped oracles resolve the homecoming (pkg/frontend/data_branch_pk_move_link_test.go:1420-1469; test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:1514-1561; test/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:1088-1133).
Design revision r112 (fc2ffa78a4, this branch; doc content MD5 9399a6cb655c022c088595230cb553e4; new decision D229) amends D228's revisit clause: a verified pairing hop landing on the lineage's own previously visited key is a proven return and continues under the parser's birth-certificate order (a strictly backward certificate fails closed as corrupt evidence); strictly increasing stmt_seq plus the hop cap bound the walk; the terminal NULL pairing ends the chain at the returned key and the fold planner's oldKey == finalPK path folds changed/unchanged payloads; the fold planner still rejects true multi-row key rotations. The per-(table, window) attribution and window-membership admission this thread demanded stand unchanged, and the thread-demanded multi-generation/sibling regressions remain in the section-10 validation map, now joined by the changed/unchanged-payload MERGE/PICK return-home twins over persisted pairs in stamped and stamp-pending forms.
Submitted for fresh independent design approval; implementation waits for that approval. Full ledger: PR body section "Design checkpoint (2026-11-02, r111 review outcome + r112 revision)".
There was a problem hiding this comment.
Updated disposition for the current design checkpoint: this thread's demanded per-(table, window) attribution and window-membership admission stand unchanged in r113/D230 (commit d7233b81360fdb7d80592724a64ecca308c37483, pushed; doc MD5 930c9c0645ff3e961b76e13347b14369) — the D226 windowed gate still excludes the out-of-window straddler before any identity comparison, and the thread-demanded multi-generation/sibling regressions remain in the section-10 validation map. Since the last disposition the independent design review rejected r112 (P2: the revisit rule admitted only recorded same-transaction pairings and same-key tails, so two separately committed updates 2->3 then 3->2 aborted when the cross-transaction departure returned to the seeded anchor key, contradicting retained D66's approved r100 text). Verified valid at the cited loci (pkg/frontend/data_branch_pk_move_link.go:2879-2929, :3148-3161, :3173-3178, :3290-3301, :3381-3393; pkg/frontend/data_branch_hashdiff.go:3423-3435; test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:1431-1476; test/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:1006-1051), and r113 amends the revisit clause: a hop landing on a previously visited key follows the parser's birth-certificate order for every hop class — strictly backward fails closed, equal continues only through the verified recorded same-transaction pairing, and strictly newer continues through any proven channel including an ATTRIBUTABLE cross-transaction departure (departed-birth-pinned pairing + D226 windowed admission) — while a foreign row's departure is never served and fails closed. Submitted for fresh independent design approval; the PR body carries the r112-outcome + r113 ledger section.
There was a problem hiding this comment.
Disposition update (2026-11-02, design revision r114): the per-(table, window) attribution and window-membership admission this thread demanded stand unchanged through r113/D230 and r114. r113 was REJECTED at independent design review on a different finding (P2): its fold-shape text prescribed an in-place no-op for an unchanged payload on EVERY proven cross-transaction return to a vacated key, but the attributable 2->3->4->3 chain ends at an INTERMEDIATE vacated key 3 while the destination anchor holds key 2 (finalPK != oldKey) — the primary key still changes, so both payload forms must fold as a native UPDATE 2->3 with the exact parent key-3 row and the child at parent_id=3; approved r100 D66 permits a no-op only for an identical final image at the ORIGINAL key. Verified valid at the cited loci (pkg/frontend/data_branch_hashdiff.go:3384-3391 preserves both keys; pkg/frontend/data_branch_output.go:2265-2289 emits the native UPDATE through the original-key predicate). r114 (c396dcd7f8, this branch; doc content MD5 6b8876d1be0a0739c2193e1cc99a5c22) amends D230's fold-shape clauses with new decision D231: the fold shape is decided by WHERE the chain ends — an original-key return (2->3->2; finalPK == oldKey) keeps D66's homecoming (changed payload → in-place native UPDATE; unchanged complete image → in-place no-op), while an intermediate-key return (2->3->4->3; finalPK != oldKey) is ALWAYS a native UPDATE in both payload forms. D230's admission rule is untouched. Section 10 now demands MERGE and PICK KEYS(2) twins of the attributable 2->3->4->3 return asserting the native UPDATE 2->3 with exact parent/child key-3 assertions for BOTH changed and unchanged payloads, stamped AND stamp-pending, alongside the carried multi-generation/sibling regressions. Submitted for fresh independent design approval; implementation waits for that approval. r113 was never implemented.
There was a problem hiding this comment.
Design disposition update (2026-11-02, r115): the per-(table, window) attribution and window-membership admission this thread demanded stand unchanged (D226), and the demanded multi-generation/sibling regressions remain in the section-10 validation map. Since the last update here, the design line advanced through three independent-review repairs, all submitted as design-only revisions before any implementation: r113/D230 (proven cross-transaction returns resolve under the windowed gate — the departed-birth-pinned hop binds the lineage's own landed version and the successor passes the windowed admission gate), r114/D231 (fold shape decided by where the chain ends — an original-key return keeps the homecoming shapes; an intermediate-key return is always a native UPDATE in both payload forms), and now r115/D231's successor D232 (a non-NULL recorded continuation is validated and followed BEFORE any timestamp claim; missing or contradictory pairing evidence aborts without falling through to a claim — mirroring the shipped parser's order at pkg/frontend/data_branch_pk_move_link.go:3183-3237 before :3239-3301). r115 is commit a002694 on this branch (docs/design/20261016-data-branch-pk-move-update-provenance.md, doc content MD5 edb6a8ddba8072c3b2d7e044fa5e97b9), submitted for fresh independent design approval; implementation — including the cross-fork straddler MERGE/PICK regressions this thread required — waits for that approval. r113 and r114 were never implemented.
There was a problem hiding this comment.
Fixed in the pushed implementation (commit 72bed34633, implementing the approved r115/D232 design). The probe no longer merges candidates across window boundaries before commit membership is established:
-
Per-(table, window) attribution is kept until actual commit membership is known. Every link row now carries its recording transaction's commit instant (
commit_ts binary(12) null, D225), stamped best-effort by a commit-completion callback and otherwise recovered through the D227 outcome table.mergeProbedLinksLockedstamps every probed row with the window it was probed under, and the D226 admission gate admits a candidate at a departure instant only when its stored commit instant equals that instant AND falls inside the candidate's own attributed (table, window) segment. Your exact schedule — X begins on P at t20 before S forks at t30, moves the inherited row, and commits at t40 outside the P segment — is excluded at the gate: X's link keeps its (oldRowID, oldPK) identity but is never admitted into S's lineage windows, so it can neither bind nor poison S's valid anchor. S's own in-window move (commit t50 inside the S segment) still cascades as one native UPDATE. -
The multi-generation/sibling-branch regression you demanded ships as MERGE and PICK twins: the stamped cross-fork straddler (transaction begun on the parent before the source fork, writing and committing after it, under READ COMMITTED) at
test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:3200andtest/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:2709; the NULL-stamped (stamping-failure injection) straddler at merge:3234and pick:2743; the sibling independent DELETE+INSERT shapes at merge:3269/:3311and pick:2778/:2820(two-transaction and one-transaction forms — with the candidate excluded, zero admissible candidates is proven absence, so the sibling's same-key delete+insert keeps plain legacy replay: no UPDATE cascade onto the replacement row, no provenance abort); and the component-level gate oracleTestAnchorWindowedAdmissionExcludesStraddler(pkg/frontend/data_branch_pk_move_link_test.go:7361), including the coincident-commit-instants subcase that proves the window attribution — not a timestamp tie — is the excluding mechanism. All green on the pushed head, with the full files replayed 100% on an isolated service.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f1f029afe259bc9405e435a5cecde2d743a39623
Assessment: request_changes
New discussion changes the prior approval: source tracing confirms that an out-of-window ancestor commit can invalidate a valid child update. Earlier repairs and design approval remain accepted.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
- P2
pkg/frontend/data_branch_pk_move_link.go:1074: Persist key 1 in parent P; fork destination D; start transaction X on P; fork source S; then X moves P's 1→2 and commits, and S moves its inherited 1→3. Merge S into unchanged D.
Impact: The ancestor link passes the creation-time filter despite committing after S's fork. Because persisted clones share row identities, merging both links poisons S's valid anchor and aborts a conflict-free MERGE.
Evidence: The writer records CreateTS (multi_update/pk_move_link.go:357). Probe SQL filters write_ts without an endpoint snapshot (:1012), then mergeProbedLinksLocked conflicts links before commit-window validation. byRowProbeVerdict returns incomplete (:1341), causing resolveAndBuildPkMoveFolds to abort (data_branch_hashdiff.go:3241). Preserve window attribution until membership is verified, or snapshot-anchor each window's read, before conflict-checking links. Add the cross-fork transaction regression. Detailed source reasoning is retained in source-reasoning.md.
Validation:
-
Verified frozen head/base, matching patch and clean source; classified all 65 discussion keys.
-
Static audit passed: source-audit.log and checks/1793613700739937937-2.json; receipt reconciliation retained in validation-evidence.json.
-
Reused unaffected coverage from exact-head review 5733859893. Frozen CI reports 14 successful, 14 skipped and 2 neutral checks.
Limitations:
-
The finding is source-verified; no fresh Go tests or SQL reproduction ran.
-
Raw historical runtime and CI logs were not supplied; skipped upgrade checks are not passes.
PR matrixorigin#31629 review (aunjgr, 2026-11-02T09:41:16Z) found that the provider's catalog probes read the apply statement's current snapshot with only write_ts <= endPhys, where write_ts is the recording transaction's CREATE timestamp: an ancestor transaction begun before a fork but committed after its lineage window ended was visible to that window's probe, and mergeProbedLinksLocked poisoned the shared (old row id, old pk) identity before stream commit-membership screening could exclude it, aborting a conflict-free merge. r106 adds D223: every provider-window catalog read anchors at the window's full end timestamp ({MO_TS = '<phys-logical TS>'}, the D222 anchor form), a window whose end predates the link catalog's creation in its owner account degrades to complete absence (extending D220 (B.4)), and the PICK key-closure probes keep the wider unanchored read since over-admission there only widens the dependency-key set. Section 5.3 states the repaired bounds, section 10 maps the regression evidence, and section 11 records the decision and traces the revision for independent design approval. Design-only change; implementation follows the D223 approval.
The independent design review of r106 rejected D223's snapshot-anchored provenance reads: the link catalog's historical storage versions are not covered by any snapshot/PITR channel (core-catalog-only all-snapshot protection, system-table skip in table-snapshot propagation, mo_catalog PITR only via user PITRs), no CN-expressible protection exists, and a TN change is out of scope. r107 withdraws D223 before implementation and repairs the reviewed straddler defect without historical catalog-state reads: probes stay on the current snapshot, links keep per-(table, window) attribution, and identity conflict checking is deferred until the D156 scope-to-commit capture establishes commit membership (D224). Adds the section 9.3 storage-version retention audit and the section 10 lifecycle validation scenario (table-scoped protection only, catalog rewriting/reclamation, restart, exact MERGE/PICK cascade assertions). Doc content MD5: 5fbaf365635abc61d9a66e09f72448d9
The independent design review of r107 rejected D224 on two findings: (P1) the single-candidate exemption admitted an unscreened out-of-window candidate, letting a singleton straddler link splice onto a sibling branch's independent DELETE/INSERT; (P2) membership screening depended on the link catalog's reclaimable committed change history, stranding valid retained branches after reclamation. r108 (D225) preserves the recording transaction's full-precision commit instant inside the live link row (new commit_ts column, CN commit-completion stamping), gates every chain candidate on it with no exemption, retires the D156 capture from every resolution path, and restores the lifecycle oracle to exact cascade assertions after reclamation and restart. Design-only; no production code changed.
…ery (r109) The independent design review of r108 returned REQUEST_CHANGES (P1+P2): - P1: D225(d) treated commit_ts equality as sufficient window membership and discarded per-window attribution. One RC transaction begun before a fork (per-statement snapshot advance) can perform the ancestor move AND the sibling's independent DELETE/INSERT in a single commit; the ancestor link's commit_ts then equals the sibling anchor's departure instant while lying outside its own window, so equality-only admission splices it onto the sibling's pair and the count guard passes a wrong UPDATE cascade. - P2: r108's two-step publication left NULL commit_ts permanent after a stamping failure/cancellation/crash/lost commit response, and made that state abort forever, stranding otherwise valid committed branches; COMMIT-result semantics were unclosed. D226 repairs both before implementation: - Per-(table, window) candidate attribution restored; admission requires commit_ts inside the candidate's own attributed window in addition to equalling the departure instant, checked before any identity comparison or arrival attribution (the arrival tie amended identically). - NULL commit_ts becomes a durable stamp-pending intent: resolution re-derives the commit instant from the protected user-table stream (the linked row version dies exactly once; I7 ties the link to that commit), with same-transaction inheritance for placeholder chains and a best-effort re-stamp; stamping is best-effort and never alters the user-visible COMMIT result; a rolled-back move leaves no provenance. Loud aborts remain only for genuinely incomplete or ambiguous evidence. Sections 5.1-5.4, 6.2, 9.3, 10 (window-mismatch gate assertions, the one-transaction cross-branch MERGE/PICK oracle, recovery UTs, deterministic crash/failure checkpoints) and 11 updated. Submitted for fresh independent design approval before implementation; r108 never shipped.
… payload forms (r114)
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: a002694fc44c8e9d3d8cd941608cf57fcae4fee5
Assessment: request_changes
The previously reported provenance-window defect remains unresolved. Revision r115 updates the proposed repair; production code and tests are unchanged.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/frontend/data_branch_pk_move_link.go:1074: A parent transaction starts before a source branch forks but commits its key move after the fork. The source independently moves the inherited row, then merges into an unchanged sibling destination.
Impact: The out-of-window parent link poisons the valid source anchor, causing a conflict-free MERGE to abort. Preserve per-window attribution and exclude inadmissible links before identity-conflict checks; add MERGE/PICK regression coverage.
Evidence: The producer records CreateTS (multi_update/pk_move_link.go:357), while current-snapshot probes filter only write_ts <= window.endPhys. mergeProbedLinksLocked combines links by old row ID and key before checking commit membership. byRowProbeVerdict returns incomplete for the poisoned anchor, and data_branch_hashdiff.go:3241 aborts apply. This matches the acknowledged prior finding; the proposed repair remains unimplemented.
Validation:
-
Static audit passed: checks/1793640667634108690-5.json and static-review-audit.log verify frozen source, 151 changed paths, and 150 non-design paths identical to the previously reviewed implementation.
-
All 87 discussion keys are assessed exactly once in discussion-assessment.json; earlier repaired findings were reconciled against current source.
-
validation-evidence.json reconciles both audit receipts, including the initial terminal-newline comparison failure. Frozen CI reports 14 success, 14 skipped and 2 neutral.
Limitations:
-
No fresh Go or SQL tests ran; the finding is established by source analysis. Raw CI logs were unavailable.
-
Unaffected prior coverage was reused. The unimplemented r115 stamping/recovery protocol is not certified by this assessment.
…RANCH apply Implement the approved r115/D232 design for issue matrixorigin#28026 (docs/design/20261016-data-branch-pk-move-update-provenance.md): - D225: best-effort commit-completion stamping of each link row's commit_ts through a CommitEvent completion callback; stamping never changes the user-visible COMMIT result, and a failure leaves the durable stamp-pending NULL for recovery. - D226: windowed commit-exact admission gate — every probed link keeps its per-(table, window) attribution until stream commit membership is established, so an out-of-window straddler can neither bind nor poison a sibling/descendant anchor. - D227: single recovery outcome table for a pending commit instant: heal from the protected change stream, inherit across the transaction's own netted generations, exclude on proven window absence, abort loudly only on corrupt or incomplete evidence. - D228: recorded same-transaction continuation pairing (succ_link_id/stmt_seq), computed unconditionally at commit over the converged post-prune set; NULL means terminal. - D229/D230/D231: proven same-transaction homecomings and attributable cross-transaction returns resolve under the windowed gate; the fold shape is decided by where the chain ends (intermediate-key returns are always native updates in both payload forms). - D232: the recorded continuation channel is settled FIRST at every hop before any timestamp claim; missing or contradictory pairing evidence aborts loudly without fall-through; a NULL pairing is terminal subject to the loud cross-check. Arrival attribution binds backward hops through the inverse recorded pairing (pkMoveArrivalPredIndex.bySucc), never by (key, scope) inference, so two lineages sharing one netted temporary key in one transaction resolve independently. BVT: MERGE/PICK pk-move files extended with the cross-fork straddler twins, stamped and stamp-pending chain/homecoming/return twins, vacate-before-arrival schedules, the shared-temporary-key case, and the stamping-failure injection sections. Two committed BVT expectations are corrected by result regeneration (expectation updates, not code changes): 1. The pick tc fixture (r59 review F1: A moves 1->2; one later transaction deletes A's landed row at 2 and moves a foreign row through a forty-hop chain onto the same key) asserted the old key-chained walk's conservative abort, which had to ground the foreign arrival by walking that chain beyond the attribution hop cap. The r115 walk's departed-birth-pinned pairing index serves A's own death directly, so the foreign chain is never walked and A's proven deletion applies as an exact DELETE cascade -- the verdict the short-chain stail sibling already produced. The hop-cap fail-closed posture stays covered by the injected probe-budget BVT and TestPkMoveLinkProbeBudgetAndBounds. 2. The new r107/r108 sibling DELETE+INSERT cases (merge cfd/cfo, pick pfd/pfo) asserted a loud RESTRICT rejection with unchanged destination rows. The actual legacy same-key delete+insert apply succeeds: the destination accepts the sibling's replacement parent row and the post-apply foreign-key state is satisfied (control-proven on a link-free schedule, so this is untouched legacy behavior, not a fix side effect). The review substance stands and is what the cases now assert: with the out-of-window straddler excluded (the probes show its link on the parent table and zero links on the sibling), zero admissible candidates is proven absence, so there is no UPDATE cascade onto the replacement row and no provenance abort -- the schedule the pre-fix probe poisoned and aborted. The design's section-10 I2 cell predicted the rejection oracle from a wrong assumption about legacy delete+insert mechanics; the D226 mechanism it specifies (windowed exclusion -> proven absence -> legacy replay) is implemented and proven exactly as approved.
…collect test The link batch auto-widens from the catalog TableDef, which gained commit_ts, succ_link_id and stmt_seq in the parent commit, but TestCollectUpdatePkMoveLinkRowsInt32Pk still asserted the 10-column attribute list (UT Coverage failure in run 41544318517). Extend the expectation and pin the staged placeholders: commit_ts and succ_link_id stage NULL until the commit hook and pairing fixup stamp them, stmt_seq stages 0 until the workspace fill hook stamps the statement ordinal.
CI SCA (Linux/arm64, run 41549388513) flagged four lint issues on the PR's new code: - gofmt comment alignment in data_branch_pk_move_link_test.go and pk_move_link_stamp_test.go - prealloc: build the pkMoveWalkTestRow view with capacity 4+len(extra) - staticcheck SA6001: index departures[acct][string(newPK)] directly instead of binding the converted key first No behavior change.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 20b700339415d854b7e72dfc4e85d2c571c5a34e
Assessment: request_changes
The earlier immediate window-poisoning defect is resolved, but two new persistence defects remain in timestamp recovery and continuation pairing.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
-
P1
pkg/frontend/data_branch_pk_move_link.go:2182: A parent PK move commits after a child forks and its commit stamp is missing. The child subsequently moves the inherited row, sharing its original row identity.
Impact: Recovery uses the child's death timestamp and queues it for the parent link before window exclusion. A successful apply persists the wrong timestamp. A later parent apply then loses UPDATE provenance and can invoke destructive DELETE cascades instead of ON UPDATE behavior.
Evidence: The focused provider probe generated an UPDATE stamping the ancestor at 50 instead of its actual commit at 40; loading that value made the later parent walk return pkMoveProvenNone. The correctly stamped control passed (probe-run.log:249–256). Recover only from the candidate's attributed physical table/window and test both persisted metadata and a subsequent parent apply. -
P2
pkg/vm/engine/disttae/pk_move_link_fixup.go:4135: Commit-stamping or recovery UPDATEs reinsert historical link rows, and Transaction.Commit runs continuation pairing again. These updates may combine original transactions or contain only part of a chain.
Impact: Pairing ignores original transaction scope and can fabricate cross-transaction successors. Rebuilding a chunk's successor column can also erase a valid successor outside that chunk. Subsequent valid MERGE/PICK operations fail provenance verification.
Evidence: Both final pairing probes failed: a historical terminal gained another transaction's successor, and a partial-chain update cleared an existing successor. All nine existing pairing controls passed (pairing-probe-v2.log). Restrict pairing to newly recorded links; stamp updates must preserve existing continuation credentials verbatim.
Validation:
-
Isolation preflight and native build passed; 193 native input hashes matched frozen sources. Receipts: checks/1793672101699280982-3.json and checks/1793672219673993617-6.json.
-
Focused recovery and pairing probes reproduced the defects with passing controls. Logs: probe-run.log and pairing-probe-v2.log; receipts: checks/1793672672499003427-3.json and checks/1793672746654302627-3.json.
-
Evidence audit passed: source unchanged, 153 paths mapped, 20 incremental paths inspected, 133 unchanged paths qualified for prior coverage, and all 92 discussion keys classified. Receipt: checks/1793673018149537554-4.json.
Limitations:
-
These were internal probes; recovery SQL was captured rather than executed against a database. Downstream business impact was traced through source.
-
Raw CI and external author validation logs were unavailable. Supplied CI reports 14 successful, 14 skipped and 2 neutral checks.
-
Broader SQL, restart, upgrade and performance validation stopped at the confirmed persistence defects.
…ndow Review repair for PR matrixorigin#31629 (mo-bot review PRR_kwDOFEPiGM8AAAABVoTNeA, findings P1 and P2). Both fixes conform the implementation to the approved design docs/design/20261016-data-branch-pk-move-update-provenance.md r115 (decisions D225-D232); no design revision is required. P1 (data_branch_pk_move_link.go): D227 NULL-stamp recovery must be scoped to the candidate link's attributed physical table/window. When a parent PK move commits after a child fork (commit stamp missing) and the child then moves the inherited row with the same row identity, recovery healed the parent's stamp from the child's out-of-window death instant and queued the D227(e) re-stamp before window exclusion. A successful apply persisted the wrong timestamp, so a later parent apply found stamp != departure instant and fell to pkMoveProvenNone, losing UPDATE provenance and inviting destructive DELETE cascades instead of ON UPDATE behavior. Fix: in resolveLinkCommitLocked, siblingCommitLocked, and the departure-pairing directed heal, skip death references whose commit instant lies outside the link's attributed window before any heal or queueRestampLocked. Only in-window deaths are evidence for the link. Regression: TestPkMoveRecoveryHealsOnlyInsideAttributedWindow (data_branch_pk_move_link_test.go) reproduces the ancestor/child schedule from the review: out-of-window child death neither heals nor re-stamps the ancestor link (fails pre-fix), the unpolluted stamp lets the later parent apply resolve the move, and the control pins that persisted metadata decides the parent apply. P2 (pk_move_link_fixup.go): commit-stamping or recovery UPDATEs re-insert historical link rows (commit_ts filled), and Transaction.Commit re-ran continuation pairing on the re-staged batch. Pairing ignored original transaction scope, could fabricate a cross-transaction successor, and the whole-column rewrite could erase a valid successor outside the chunk. Fix: pairPkMoveLinkContinuationsLocked skips rows whose commit_ts is already filled (same qualifier as the D225 stamp collector in pk_move_link_stamp.go: those rows are not newly recorded by this transaction), and the persist step copies an unpaired row's staged succ_link_id cell verbatim instead of rewriting it to NULL. A staged batch without the commit_ts column predates the D225 layout and keeps treating every row as newly recorded (schema-drift posture). Regressions (pk_move_link_stamp_test.go): re-inserted historical rows never pair across original transactions (fails pre-fix), a partial-chain re-insert preserves an existing successor verbatim (fails pre-fix), and the stamp-independence subtest now pins verbatim preservation of a restaged leg's commit_ts and succ_link_id while a recording leg still pairs.
|
P1+P2 acknowledged — both valid, fixed on this branch (commit 194c891). P1 (timestamp recovery persistence). Confirmed against the reviewed head P2 (continuation pairing). Confirmed: Tests (RED→GREEN on both findings).
All nine pre-existing pairing controls and both windowed-straddler subtests still pass ( |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 194c8910a45bac402ec0e542defef1292bba5b5c
Assessment: request_changes
The earlier persistence defects are fixed. A separate cache identity defect can discard valid child-table provenance and restore destructive DELETE/INSERT replay.
Model: gpt-6.1-sol / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
- P1
pkg/frontend/data_branch_pk_move_link.go:1087: Begin an RC transaction before a fork, then perform the same PK move on the parent and cloned child through S3-buffered updates with NULL new_row_id values. MERGE/PICK the child into an unchanged sibling.
Impact: The ancestor candidate is cached first and the distinct child link is discarded. Window admission excludes the ancestor and incorrectly reports no update provenance. Replay falls back to DELETE/INSERT, which can delete FK children through ON DELETE CASCADE instead of preserving them through ON UPDATE.
Evidence: samePkMoveLinkIdentity at line 411 ignores physical link_id and window; anchorCandidates reads only the deduplicated byRow list. The extracted-function probe reproduced one candidate for two physical link IDs, with both controls passing (cache-probe-frozen.log; checks/1793684146167072839-2.json). The no-link fallback is traced at data_branch_hashdiff.go:3110. Deduplicate by durable physical identity while retaining window attribution, and add matching-move cross-fork MERGE/PICK regressions.
Validation:
-
Mapped all 153 paths, qualified prior coverage for 149 unchanged paths, reviewed the complete four-file repair and classified all 95 discussion entries.
-
Isolation preflight passed. The internal cache probe reproduced candidate loss; distinct-move and identical-reprobe controls passed.
-
Final static audit passed: checks/1793684327788929174-2.json; source-audit-final.log. Source remained unchanged; setup failures and terminal receipts are retained.
-
Frozen current-head CI reports successful build, UT, SCA, coverage and both active multi-CN BVT jobs.
Limitations:
-
The probe uses extracted production functions with minimal type stubs. The public SQL and FK consequence is source-traced, not freshly reproduced.
-
No fresh full-package, BVT, restart or upgrade runs; raw historical author and CI execution logs were unavailable.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Follow-up review of head 194c891 over prior reviewed head 72bed34; the three-commit delta has no merges: 0f4c3ae aligns the int32 collect test with the widened 13-column link batch schema, 20b7003 is behavior-preserving SCA style work, and 194c891 repairs both persistence defects mo-bot reported at head 20b7003. I verified the repairs in source and with focused tests. resolveLinkCommitLocked and siblingCommitLocked (pkg/frontend/data_branch_pk_move_link.go:2169, 2226) now scope heal, taint, and re-stamp to deaths inside each link's own attributed window, and the departure-pairing lane (line 3624) applies the D226 window gate before any restamp is queued, so an out-of-window generation's death is never persisted onto an ancestor link and a later parent apply keeps its UPDATE provenance. pairPkMoveLinkContinuationsLocked (pkg/vm/engine/disttae/pk_move_link_fixup.go:4187) now skips staged rows whose commit_ts is filled, which is the same qualifier the D225 stamp collector uses for re-inserted historical images from stamping or recovery UPDATEs, and the succ column rewrite copies an unpaired row's staged cell verbatim, so a stamping transaction can neither fabricate cross-transaction successors nor erase out-of-chunk credentials. Fresh recording links always stage commit_ts NULL and pairing runs before the post-commit stamp, so genuine pairings survive; vector.AppendBytes copies bytes, so the verbatim copy survives old.Free. At this head the documented native prerequisite build (make cgo) exited 0 and focused tests passed through the repository's mo-cgo-test wrapper (exit 0): TestPkMoveRecoveryHealsOnlyInsideAttributedWindow, TestResolvePkMoveChain, TestAnchorWindowedAdmissionExcludesStraddler, and TestSameKeyTailFailsClosedPastTruncatedForeignArrival in pkg/frontend; TestPairPkMoveLinkContinuations including the two new re-inserted-rows and partial-chain subtests plus TestCollectPkMoveLinkStampSet in disttae; TestCollectUpdatePkMoveLinkRowsInt32Pk in multi_update; gofmt clean on the five delta files. Previously blocking topics are fixed and remain fixed: the hash-map encoder-allocation regression, aunjgr's out-of-window straddler poisoning (72bed34's D226 windowed admission gate, its regression passing locally), iamlinjunhong's prepared-UPDATE retentionSource rebind, the subscription owner-scope and victim-delete-ordering P1s, the per-feature upgrade protocol gates, and fengttt's fix-strategy and vectorized-encoder requests, which the maintainer approved at 20b7003. Open items recorded for visibility and kept out of findings per the no-duplication policy: mo-bot's current-head P1 (samePkMoveLinkIdentity at pkg/frontend/data_branch_pk_move_link.go:1087 ignores physical link_id and window when deduplicating byRow cache entries, which can discard a valid child link and restore DELETE/INSERT replay) remains unaddressed by the author and stands on mo-bot's thread; the documentation P2s first raised at 8c573bb and recorded at f1f029a (pkg/frontend/predefined.go:443 still names the deleted pkg/bootstrap/versions/v4_0_19, the design-doc upstream attribution sentence, and catalog-upgrade-407's superseded entry counts) remain open and non-blocking. Limitation: plain go test invocations failed at build before the documented CGO artifacts existed; that was resolved by the documented make cgo build, and full UT/BVT suites were not run locally.
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28026.
What this PR does / why we need it:
Problem
A branch-side primary-key change is emitted as an independent delete of the old key plus an insert of the new key.
DATA BRANCH MERGEandDATA BRANCH PICKreplayed that pair as DELETE/INSERT, so the parent-row delete failed with the foreign-key constraint error whenever the destination declaredON UPDATE CASCADE(orON UPDATE RESTRICT) actions, while an ordinaryUPDATEon the same parent key succeeded and cascaded to the child.buildHashmapForTable/findDeleteAndUpdateBatcould correlate the delete and the insert only by primary-key value, which breaks as soon as the key itself changes; matching by commit timestamp or iteration order is unsafe and was rejected.Root cause
multi_updatedeleted the old row while writing the replacement without a durable operation identity, sodatabranchutils.CollectChangesexposed the old row as a tombstone and the replacement as data with no old-to-new association.Fix strategy (the idea)
The branch-side update protocol is unchanged: a primary-key
UPDATEstill deletes the old row and inserts the new one, and the change stream still carries that delete/insert pair. The fix adds durable provenance for the pair and collapses it back into one update at apply:multi_updatechanges a primary key, it registers a fenced old-key -> new-key link inmo_catalog.mo_data_branch_update_linkin the same transaction as the delete+insert (keyed first-writer claim, genesis-locked).ChangesHandle/CollectChanges) resolves each delete+insert pair through that link instead of exposing two unrelated row operations.UPDATE, so declaredON UPDATE CASCADE/RESTRICTactions run exactly as for an ordinaryUPDATE. Delete+insert pairs without a proven link keep plain DELETE+INSERT semantics -- independent deletes and inserts never synthesize an update.What this PR does (exact changes)
multi_updateproducer registers a genesis-locked old-to-new link for every primary-key move intomo_catalog.mo_data_branch_update_link(keyed first-writer claim with fencing); the change stream (ChangesHandle/CollectChanges) re-associates the delete/insert pair through that link, and MERGE/PICK apply the move as one native destinationUPDATE, letting declaredON UPDATE CASCADE/RESTRICTactions run.mo_data_branch_link_retentionledger); fail-atomic owner-removal reaping onDROP SNAPSHOT/DROP PITR/table retirement, including orphan-parent KEEP rows and account-name mapping coverage; bootstrap upgrade wiring for the new catalogs.link_idprimary-key prefix range[tableID, tableID+1)(the catalog's sole primary key islink_id), matching the shared retention probe, so producer reads stay keyed instead of falling back to full partition scans.pkg/container/vector):mo_data_branch_update_linkkey bytes must compare verbatim against the data-branch hash-map keys the frontend already materializes, and this PR adds engine-side readers/writers of those keys indisttae, which cannot importfrontend. The existing Packer cell-encoding switch therefore moved unchanged fromdatabranchutils/branch_hashmap.gotopkg/container/vector(the lowest layer seeing bothVectorandtypes.Packer), exposed as a bind-onceRowEncoder-- one type dispatch per vector, byte-identical output pinned by equivalence tests.merge/pick_foreign_key_pk_move,merge/merge_link_retention_linkfree,merge/merge_link_retention_fail_atomic; stable-key FK update regressions retained; unit suites for genesis locking, fencing admission, owner coverage, retention schema/lockkeys, and conflict cells.Issue-to-test proof
ON UPDATE CASCADE, branch PK move 2→3, MERGE/PICK accept): the verbatim SQL battery is byte-identical to the pre-approved GREEN reference, witnessing MERGE and PICK both applying the move as one UPDATE and the child key cascading to 3, matching a nativeUPDATEcontrol.merge_foreign_key_pk_move.sql/pick_foreign_key_pk_move.sql: 2025/2025 and 1738/1738 statements green (100%, run mode against this head), covering cascade apply, RESTRICT rejection, failure atomicity, the r60 cascading-victim-delete rollback regressions, self-retirement and owner-removal retention witnesses, account/database/table snapshot and PITR coverage, chain moves, and historical clones.merge_link_retention_fail_atomic.sql: injected reap failures roll the owningDROPstatement back atomically with certified fencing envelopes.go test ./pkg/sql/colexec/multi_update(genesis lock, keyed-range probe regression, seal/mark invariants),go test ./pkg/vm/engine/disttae(change-stream link export), frontend conflict-cell fabric tests on embedded TN.Residual risks
Review repair (2026-10-30, mo-bot P1: cascading victim deletion vs the I4 zero-match guard)
Review reproduced MERGE and PICK reporting success after a cascading victim deletion removed the row they were meant to update: source deletes key 3 and moves key 2→3 while destination row 2 references row 3 through a self-referencing
ON DELETE CASCADEforeign key underWHEN CONFLICT ACCEPT. The count guard saw row 2, the authorized victimDELETEof row 3 cascaded into row 2, and the UPDATE matched zero rows yet committed with an empty destination, violating the design's I4 zero-match rejection invariant.Fix (
pkg/frontend/data_branch_output.go,execKeyMovingUpdate): in direct (non-file) mode the authorized victim delete now executes inside the same transaction BEFORE the I4 preflight count, so ON DELETE actions settle first; the guard then reads the settled state and, finding zero rows, raises the named error and rolls the whole apply back — the cascading deletion is reverted with it. File-output mode keeps its historical statement order and stays unpreflighted by design (D7). Guard SQL, error text, and statement content are unchanged; only execution order moved.Proof: UT
TestExecKeyMovingUpdateVictimDeletePrecedesGuardpins the execution order (victim delete → count guard → update), abort-on-zero when the cascade erased the target, and success when the target survives (fails pre-fix, passes post-fix). New BVT cells inmerge_foreign_key_pk_move.sqlandpick_foreign_key_pk_move.sql: the self-referencing CASCADE case now errors with "cannot apply the accepted row ... found 0" and the destination keeps its pre-apply rows (rollback asserted, not just the error); the ON DELETE SET NULL control still applies successfully. Both suites pass 100% in run mode against this head (2025/2025 merge, 1738/1738 pick). Live end-to-end on an isolated service built from this head: MERGE andPICK KEYS(2,3)both abort withERROR 20101 (HY000) ... expected exactly one destination row at key (2), found 0with the destination preserved at(2,3,'two'),(3,NULL,'three'); the pre-fix binary reproduced the reviewer's silent success with an emptied destination for both probes.Note on the regenerated oracles: re-running genrs against this head also normalized the informational error text recorded after eleven merge / nine pick
-- @regex("...foreign key constraint fails...", true)directives, dropping the "internal error: " prefix to match what the binary now emits. Those recorded lines are informational (run mode checks the regex, and both suites were and remain 100% green on this head); no result rows or verdicts changed.Base update (2026-10-29)
Rebased onto
main3cf38889bcto resolve conflicts with upstream consolidation PR #31497 (frozen 4.0.7 upgrade route) and #31484 (variadic lock wait policy). This PR's tenant-upgrade handler moved from unpublishedv4_0_18tov4_0_8(min_upgrade_version4.0.7), and the interrupted-route / legacy-CDC gates inpkg/bootstrap/service_upgrade.gonow key on the recorded cluster version against the registered frozen 4.0.7 handler, so they survive future final-version bumps. Bootstrap routing suites (TestPublishedCatalogUpgradeRoutes,TestLegacyCDCAdmissionBeforeUpgradeMutation, manual-replay guards) pass locally.The rebase validation also hardened one classification contract:
awaitLedgerWatermark's fold-error mapping now surfaces any error observed at or after the one absolute fold deadline — and any inner lock WAIT timeout — as the namedwatermark fold timeoutclass, closing a stall-window leak of MySQL-1205Lock wait timeoutobserved during a host-wide scheduler stall (allocator's own logs showed ~10s freezes).CI repair (2026-10-29, commit e686d10)
Fixed the SCA license-header failure from run 40773355581 (
SCA Test on Linux/arm64): corrected the Apache URL typo (LICENSE-2.2→LICENSE-2.0) inpkg/vm/engine/disttae/engine_orphan_gc.goand added standard Matrix Origin headers topk_move_pin_charge_test.go,pk_move_rollback_index_test.go, andpk_move_shrink_boundary_test.go. Verified locally withlicense-eye -c .licenserc.yml header check(4/4 valid) plus a header audit of all 123 PR-changed code files; no code behavior changed.CI repair #2 (2026-10-29, commit 63d8b07)
Fixed the SCA
err-check+ golangci-lint failure from run 40776611402 (SCA Test on Linux/arm64):err-checkrejectsfmt.Errorf/errors.Newtext in non-testpkg/code, and the new pk-move files carried 25fmt.Errorfsites plus oneerrors.Newsentinel — all converted tomoerrconstructors. The three per-account reap wraps keep inner-error identity for the fail-atomicrequire.ErrorIsassertions through a typeddataBranchReapAccountErrorwithUnwrap(message text unchanged). Also cleared the fourteen golangci-lint findings the same job surfaces onceerr-checkpasses: a govet nilness dead branch in the logtailreplay change-handleNextmethod, three ineffassign writes, two prealloc slice hints, one SA6001 non-pointer map-key copy, one SA9003 empty condition, and six unused symbols; all but that logtailreplay probe were in PR-added code (it is base code in a PR-touched package, reported because.golangci.ymlhas no new-from restriction). No behavior change. Local verification: err-check greps empty,golangci-lint -c .golangci.ymlon all 18 PR-touched packages 0 issues,go buildgreen, focused suites green — frontend retention+fold 72 RUN/0 FAIL, databranchutils 260 RUN/0 FAIL, compile pk-move 0 FAIL, plan update-link 9 RUN/0 FAIL, multi_update pk-move 87 RUN/0 FAIL, logtailreplay normalization-charge 1 RUN/0 FAIL, disttae boundary finalization 45 RUN/0 FAIL.CI repair #3 (2026-10-29, commit 1569c20)
Fixed the SCA
checkrecoverfailure from run 40788517465 (SCA Test on Linux/arm64): molint admitsrecover()only inside its whitelisted functions, and the pk-move compaction wave collected worker panics through an explicitrecover()inTransaction.compactDeletionOnObjsLocked(txn.go). The collection now lives on the ants pool'sPanicHandlerinside a new unexportedrunCompactWavehelper:finishSlotruns exactly once per submitted slot and appends the abort BEFOREDonereleases the parent wait on every completion path, and ants invokes the handler synchronously in the aborted worker's goroutine while recovering the panic (v2.12.0worker.go). The r26 review F1 contract — a panicking or unsubmittable worker fails the boundary atomically before any provenance carry or object reclaim — keeps its error-before-release ordering and identical "compaction worker aborted/submit failed" messages; the external linter whitelist is untouched. Newtxn_compact_wave_test.gopins the mechanism (panic collection exactly once, mixed waves collect only panics, closed-pool submissions fail instead of hanging, empty waves return clean). Local verification: CI-pinned molint (go1.27.1 build)check -mod=readonly ./...0 diagnostics,golangci-lint -c .golangci.ymlacross all PR-touched package trees 0 issues, err-check greps clean,go buildgreen, new UTs 4/4 pass incl.-racewith no data race, the r26 shadow-failure boundary suite and full pk-move boundary regression green. No behavior change.CI repair #4 (2026-10-29)
CI run 40797678570 (attempt 1) ended with six terminal failures. Each failed
job's terminal log was triaged individually; they reduce to five PR-caused
classes (design r99):
hard-broke at the frozen v4_0_7 handle in every case, so a tenant landing
on 4.0.7 never planned the new 4.0.8 entries; the resulting bootstrap
stall starved mo_task.sys_cron_task and cascaded through the UT jobs
(preinsert.genAutoIncrCol nil-deref). Fixed in pkg/bootstrap
(custom_upgrade.go, service_upgrade_tenant.go): the frozen 4.0.7 hop now
commits OUTSIDE the planning transaction through at most one on-demand
pass and the chain re-plans from the advanced create_version; the embed
fixture expectation follows. Verified by pkg/bootstrap UTs
(TestServiceUpgradeV407, TestPublishedCatalogUpgradeRoutes,
TestCallerOwnedTenantUpgradeRollsBackAndRetries,
TestCollationsMetadataUpgrade).
watchdog: fencing retirement ran a full witness round + watermark fold +
certification for every drop, including drops that never staged provenance,
and the storm starved the multi-CN lockservice. New D219 pre-round gate in
RunDataBranchFencingRetirementCS (pkg/sql/compile/pk_move_fencing_cs.go,
pkg/frontend/data_branch_fencing_retire.go): an exclusive ledger-row-key
grant first, then committed-link and row_kind=0 retention-identity probes
at the locked view; when neither is present the round, fold and
certification are skipped entirely. Verified by pkg/frontend/databranchutils
and pkg/sql/compile fencing/pk-move UTs.
catalog tables) — updated the eight affected oracles (sp_table, show,
database_statistics, information_schema, create_user_default_role,
restore_cluster_table, cluster_level_snapshot_restore_cluster,
clone_sys_db_table_to_new_db_table).
the same fixed object-name set, so the live-reference guard filtered the
whole round. Round 2 now writes fresh names whose distinguishing
byte lands inside the ObjectName.String() key window the guard
compares (pkg/vm/engine/test/workspace_test.go).
aborts ("data branch cannot apply N tombstone row(s): their recorded
primary-key update provenance could not be resolved completely") plus 2
rename-gate errors. Both failing suites are new in this PR, so these are
PR-caused by construction; but they did NOT reproduce in sustained local
replays: on a local two-CN pessimistic-RC cluster matching the CI cn
config, both suites are 100% green on the fixed binary — 2008/2008 merge
and 1721/1721 pick under DISK storage, and the same 2008/2008 and
1721/1721 under shared-MinIO storage. An earlier MinIO-side merge rerun
collapsed only because its startup drop-database had to traverse the
previous run's table set under shared-host saturation and blew the
mo-tester 120s statement limit (a manual drop of the same state took
136s), poisoning everything after it; on a clean cluster both MinIO
suites complete green in under five minutes. The leading hypothesis for the CI-only failures is
CI-runner evidence starvation amplified by the class-2 retirement storm,
whose gate is the direct remedy. This CI run owns the verdict.
maphash.WriteString under fifocache eviction (enqueueGhost/evict1/
deleteItem) hashing an object-name cache key that pointed into already
freed off-heap vector memory. Root cause proven PR-caused: the pk-move
link spill ferry decoded block infos with objectio.DecodeBlockInfo — an
unsafe reinterpret over the ferried batch's vector storage — and handed
blk.MetaLocation(), aliasing that storage, straight into
ioutil.LoadOneBlockWithSpecialLayout /
disttae.ConstructObjStatsByLoadObjMeta. The meta-extent read inside
FastLoadObjectMeta reaches fs.Read whose IOVector.FilePath is built from
name.UnsafeString(), so the data cache retained and later re-hashed key
bytes owned by a batch whose scope had ended; the 49152-row spill groups
(~7.3MB objects, ~2KB meta extents near the object end) match every
crash key's offset/size across all five PROXY runs on this branch, and
fulltext.sql's 3.84M-row index build supplied the cache pressure that
fired the eviction four minutes after the spills. Fixed at the two
producers, which now decode from / copy into owned locations
(pkg/sql/colexec/multi_update/pk_move_link.go read-back,
s3writer_delegate.go resetMergeBlockForOldCN); mainline UnsafeString
call sites are deliberately untouched — no hot-path cost, and the
invariant is enforced where transient memory enters the funnels.
Regression UTs (same package) record every FilePath the fileservice
serves during the read-back/repair and assert none overlaps the
ferried/incoming batch's vector storage:
TestSpilledPkMoveLinkLoadOwnsObjectLocations,
TestResetMergeBlockForOldCNOwnsObjectLocations.
Local verification: pkg/bootstrap UTs green; pkg/frontend/databranchutils UTs
green; pkg/sql/compile pk-move/fencing UTs green; merge/pick suites green on
a local two-CN pessimistic-RC cluster (see class 5). Class 6: both new
ownership UTs fail pre-fix (aliased 42-byte object-name span observed serving
the meta-extent read) and pass post-fix, and the neighboring multi_update
pk-move/S3Writer UT family stays green, 114 RUN/0 FAIL; go vet clean.
UT Coverage on Ubuntu/x86, run 40858015552 (job 123393998556) — two
failures, both proven PR-caused:
a. TestDropAccountDuringAsyncIndexInit counted 2 leftover
mo_catalog.mo_tables rows for the dropped account: the per-account
mo_data_branch_update_link / mo_data_branch_link_retention catalogs
created for every general tenant (existing tenants via the v4.0.8
upgrade) were never dropped by DROP ACCOUNT. doDropAccount now
retires both after the tenant databases are gone and before the
sink cleanups. Fails pre-fix ("Should be zero, but was 2"), passes
post-fix on the final head; focused mock regressions assert the
ordering and the abort-on-first-failure boundary
(TestDropAccountRetiresDataBranchCatalogs,
TestDropAccountDataBranchCatalogDropFailureAborts).
b. TestIssue29400CopyAlterRetainedGatePromotionFastFails/shared_gate
never saw the DROP DATABASE queue on the prior UPDATE's retained
mo_tables name pin (15s timeout): the synthetic pk-move link ctx's
cross-database ObjRef flipped LockMeta.doLock into its
multi-database branch, so every eligible single-table UPDATE
additionally retained Shared mo_database pins on the user database
and mo_catalog plus a mo_tables pin on the link row (decoded
mo_locks dumps: 4 identity locks on the branch head vs the single
retained T pin on main); the DROP queued on the database pin first
and never reached the mo_tables pin. The link ctx now declares
NotLockMeta — the internal write carries provenance only and must
not widen the owning statement's catalog name locks, matching the
planner's marker-invisible contract. Plan regression:
TestUpdatePkMoveLinkCtxSkipsMetaNameLocks; the full
issue-29400 gate group (shared_gate + exclusive_gate + fk
publication + same-table dml) passes post-fix, base passes, head
pre-fix times out.
multi-cn e2e bvt docker compose (PROXY), run 40858015552 (job
123397438257) — zz_accesscontrol/create_account.result mismatch: a
fresh account's
show tableson mo_catalog now yields 40 rows(expected 38) because the two new per-account catalogs exist. Added
both rows to create_account.result and to the same latent enumeration
in mo_cloud/mo_cloud.result (owner accountadmin, matching every other
per-account createSqls catalog); all other enumerations already
contain the tables or are filtered. The class-6 SIGSEGV fix held: no
PROXY crash in this run.
SCA on Linux/arm64, run 40872708652 (job 123443709861) — molint
checkunsafe rejected the unsafe import in
pkg/sql/colexec/multi_update/pk_move_link_location_ownership_test.go
(the linter's file whitelist lives in the pinned molint release,
which predates this PR). The test's address-window helpers now
derive backing-store addresses via reflect.Value.UnsafePointer,
which yields identical addresses to the previous
unsafe.SliceData/unsafe.StringData computation (verified
side-by-side), without importing unsafe. molint check and
golangci-lint both pass on the package; both location-ownership
tests still pass with their aliasing discrimination assertions
intact.
multi-cn e2e bvt docker compose (PROXY), run 40880445857 (job
123476367260), and Coverage (job 123495481891) — the PROXY group
ended at 99% with pessimistic-RC admission-gate failures across
git4data (pick row-1705 rename, clone_can_rollback row-61 create,
clone_auto_increment_state, remap, prepare, snapshot restores);
the Coverage merge job then failed fast because the PROXY job
never published its coverage profile (prerequisites_ready=false),
so both failures share one root cause. The two new PK-move BVT
files set the session to repeatable read mid-file for their
snapshot-conflict cases but ended without restoring read
committed; mo-tester reuses the default JDBC connection across
scripts, so later git4data files inherited the RR session and
their lifecycle statements tripped the main-branch admission
gates ("table rename is not supported outside pessimistic
read-committed transactions" on the pick row-1705 rename;
"object lifecycle statements require an existing pessimistic RC
transaction" on clone_can_rollback's begin+create). Both files
now restore read committed as their last statement (echo appended
to each .result, the same pattern as the eight existing isolation
echoes in each file). Verified on an isolated standalone instance
built from this head: pre-fix both files leave the session at
REPEATABLE-READ, post-fix at READ-COMMITTED; under an inherited
RR session, begin+create fails with 20105 "object lifecycle
statements require an existing pessimistic RC transaction" and
alter-table rename fails with 20105 "table rename is not
supported outside pessimistic read-committed transactions" (both
verbatim CI signatures), while the same statements pass after
restoring read committed on the same connection.
Review repair (2026-10-30, P1 pair: subscription provenance ownership + prepared-EXECUTE retention handle)
Two CHANGES_REQUESTED reviews (iamlinjunhong; mo-bot) landed on head
bcc8b099d4, which predates the implementing commit; head56c390d567implements design r100 D220/D221.D220 — subscription provenance keeps the publisher's account identity.
collectRange-projected provenance windows carry the routing-resolved segment owner; pre-collect PICK closure windows resolve the owner by the ordered-candidate walk rule; whole-window probes, per-key fallback reads, commit capture, and the link-catalog existence check (data_branch_hashdiff.go,data_branch_pk_move_link.go,data_branch.go) execute under the resolved owner context. A pre-upgrade owner degrades to complete absence for its own windows only. A subscriber applying a publisher-side pk UPDATE now reads the publisher's link catalog, so MERGE/PICK keep native-UPDATE semantics with FK children instead of replaying DELETE/INSERT. Coverage:pkg/frontend/data_branch_owner_scoped_d220_test.go(7 UTs: owner-context binding, per-account catalog degrade, window-owner resolution), BVTpub_sub_data_branchsection B12 (subscription MERGE/PICK over publisher-side pk moves, incl. the zero-match RESTRICT twin), and the R61 subscription fixture live-replayed RED→GREEN (MERGE/PICK fold to(3,'two')with child(100,3), aligned with the P3 oracle).D221 — retention handle re-binds to the executing transaction on prepared reuse.
MultiUpdate.PreparenowResetsinfo.retentionSourcewith the executing transaction right besideinfo.Source; a re-bind failure aborts the statement instead of writing into a removed workspace, andresetMultiSourcesclears the handle so the lazy resolver re-resolves under the executing transaction (sticky degrade bit preserved). Coverage: UTsTestPrepareRebindsPkMoveRetentionSourceAcrossReuseandTestResetMultiSourcesClearsPkMoveRetentionSource(spy harness, RED pre-fix → GREEN post-fix); live replay of the reviewers' literal scenario (prepare s from 'update t set id=3-id'; execute s; execute s;on a single-row table, crossing autocommit transactions) completes 1→2→1 with correct link/retention row counts, plus a reclaim-then-restage second cell.Base update + conflict resolution (2026-10-30, v4_0_19 relocation)
Rebased onto
mainbbfe55669ato resolve the conflict with upstream #31739 (DECIMAL reconcile), which publishedv4_0_18and reworked the same frozen-4.0.7 crossing gates this PR touches. Resolution: the data-branch catalog package (mo_data_branch_update_link,mo_data_branch_link_retention) moved from its unmerged 4.0.8 slot topkg/bootstrap/versions/v4_0_19— Version 4.0.19,min_upgrade_version4.0.18, offset 2, registered afterv4_0_18— so published clusters cross 4.0.18 first and reach the new catalogs last. The frozen-crossing fake-executor suites were adapted to the real route shape (…→4.0.7→4.0.18→4.0.19, final offset 2) rather than pin the old key, the route-statistics fixtures gained the4.0.18→4.0.19tail hop, the 4.0.7-gateway test readsv4_0_19.Handler.Metadata()dynamically, and the sqlintegrationcreate_versionpin moved to 4.0.19. No production gate logic changed; the design doc (r100) is untouched. Proof:go test ./pkg/bootstrap ./pkg/bootstrap/versions/v4_0_19green on this head; the multi_update package and the frontend pk-move UT family re-verified green on the rebased base; sqlintegration/BVT execution on a live cluster remains for CI.CI repair #5 (2026-10-30, commit 99dd9c6)
CI run 41004686126 (attempt 1) failed one BVT shard: "Matrixone Standlone CI execution / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)" (job 123899774276) — six rows of
test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql(the era-14 esy_/esyx_/esyr_ parent+child selects). The "Matrixone Coverage execution / Coverage" failure in the same run is a cascade (PREREQUISITES_READY: falseonce the BVT shard failed), not an independent failure.Root cause is a test-oracle drift introduced by this turn's base update, not a product bug. Upstream #31766 (commit b4cd00e, fixes #31614) entered the rebased base and resolves sibling MERGE/DIFF of both sides against their shared divergence point while PICK keeps per-side anchors. In era 14 of this fixture, src's ancestor records the pk move 2→3 between the two snapshot anchors (esy_s1 pre-move, esy_s2 post-move). Under #31766 semantics that move is inherited divergence of the src lineage, so the destination replays it as one native UPDATE through this PR's fold: esy_b1 re-keys 2→3 and the ON UPDATE CASCADE re-parents the child to pid 3 — instead of the pre-#31766 per-side-anchor outcome (parent {2,3}, child pinned at pid 2). The snapshot-bracketed drop twin stays byte-identical (esy_ ≡ esyx_, so drop transparency still holds), and the RESTRICT twin esyr_ now lands instead of aborting 1451 because the fold replaces the destination delete that used to trip the RESTRICT check. The previous head passed the same file 2025/2025 (run 40965129269) only because that base predated #31766.
Fix is test-only: updated the six expected rows in
merge_foreign_key_pk_move.resultand rewrote the two era-14 comment blocks to state the post-#31766 semantics; no product code changed. Verification on the exact pre-push head binary: a local era-14 replay reproduced the CI actuals byte-for-byte (parents(3,'two'), children(1,3), link counters 1, zero SQL errors), and the full file re-ran via mo-tester against the updated oracle: TOTAL 2025, SUCCESS 2025, FAILED 0 (100%, empty error log).Review repair #2 (2026-10-30, round-51 P2: subscriber PICK after publisher-side COPY ALTER)
The mo-bot review on head
99dd9c6651(PRR_kwDOFEPiGM8AAAABVFvR0Q) reproduced a subscriberPICK KEYS(2)abort — 20101 "primary-key update provenance could not be resolved completely" — after the publisher committed a pk move (2→3) and then replaced the table's physical generation with a same-schema COPY ALTER. Post-ALTER MERGE on the same stream and same-account PICK were already correct; the subscriber PICK aborted with state unchanged (no silent loss).Root cause: the PICK/provenance closure resolved its window owner by probing the current catalog for the physical
rel_idrecorded at the move. A same-schema COPY ALTER retires that physical id, so both ordered candidates missed, the owner degraded to a zero identity, and the closure readmo_catalog.mo_data_branch_update_linkunder the subscriber instead of the publisher.buildSideCollectRangealready resolved owners at each window's historical transition snapshot; the pre-collect closure probe did not.Fix (design r101, D222):
resolvePkMoveWindowOwnernow takes the window's transition snapshot and runs the same bounded ordered-candidate probe anchored with{MO_TS = '<phys-logical TS>'}(the full timestamp string the reopen walk uses). The snapshot follows the buildSide rule — intermediate windows anchor at the next child's clone TS (pathTS[i+1]), the endpoint window at the endpoint snapshot — and an empty snapshot keeps the previous unanchored probe. One bounded probe either way; no behavior change for windows with a live generation.Proof:
691f3bf…, detached99dd9c6651): clone → pk move 2→3 (pub_link_rows=1) → same-schema COPY ALTER (physical_replaced=1) → subscriber MERGE folds (m13p={(1,'one'),(3,'two')}, cascadem13fk=(100,3)) while subscriberPICK KEYS(2)aborts with the verbatim 20101 provenance error;k13pleft untouched at key 2 (/tmp/i28026-d222/replay-prefix.log).12c9eb2…): identical scenario, PICK folds tok13p={(1,'one'),(3,'two')}withk13fk=(300,3), zero SQL errors (/tmp/i28026-d222/replay-postfix.log).TestResolvePkMoveWindowOwnerAnchorsProbeAtSnapshot(anchored SQL shape with full phys-logical TS; empty-snapshot unanchored fallback; retired-generation cell resolves to the publisher only at the anchor) andTestPkMoveWindowOwnerSnapshot(selection pins), plus the existing D220 owner-scoped suite — focused run green (/tmp/d222-ut-focused.log), full./pkg/frontend/...sweep green on this head.pub_sub_data_branchsection B13 (issue 28026, design r101 D222) encodes the accused scenario with MERGE and PICK twins, FK cascade twins, and thephysical_replaced/pub_link_rowspins; single-file mo-tester against this head: TOTAL 395 / SUCCESS 395 / FAILED 0 (100%, empty error log).Review repair #3 (2026-10-30, design-doc scope: tracked artifact compacted to r102)
The aunjgr review on head
430914c128(PRR_kwDOFEPiGM8AAAABVGSekA) raised two items:Inline: historical subscription ownership after physical-generation retirement. The defect described in the inline thread is the one fixed on the already-pushed head
430914c128(design r101, D222 — see "Review repair integrate mysql parser from pingcap #2" above): the PICK closure window owner probe now anchors at each window's historical transition snapshot instead of the current catalog. The thread carries the RED→GREEN evidence and is resolved; no further code change needed.Tracked design document carried transient history. Valid. The document had grown to ~1.7 MB / 21174 lines: per-run verification logs, temporary local paths, review attestations and historical repair narratives, and its Implementation field still named an uncommitted worktree. Revision r102 (commit
053b5ffbac, this head) is an editorial compaction, no protocol or decision change: sections 2-9 (problem, invariants, logical model, failure/atomicity, compatibility, tenancy/ownership) are retained verbatim, section 10 keeps the invariant validation anchors and now lists the PR's current UT/BVT/live validation surface, and section 11 keeps the complete 222-decision register — every entry with its revision tag and refinement/supersession stamps so the chain stays traceable — plus open items O1/O2 verbatim, a compact approval trace from r1 through r102, and the review record. The Implementation field names this PR. The document is now 1040 lines / ~97 KB. The superseded full text of r101 remains reachable as linked external evidence: https://github.com/matrixorigin/matrixone/blob/430914c128ee5afd36880afd8f44d242bcc50f7f/docs/design/20261016-data-branch-pk-move-update-provenance.mdReview repair #4 (2026-10-30, design-gate traceability: independent approval record identified)
The aunjgr design-gate review on head
053b5ffbac(PRR_kwDOFEPiGM8AAAABVIdS-A) confirmed the historical-owner fix and the doc compaction, and asked for the design-first decision to be verifiable: the approval trace summarized rounds and asserted PASS without identifying the independent approval of the delivered revision. Addressed without rerunning any completed review:ca2d0d19b2a39b16c8f1103555b0d128at HEADbcc8b099d457ddf88cb9a10d1d47939b6cbc91fa. The exact reviewed bytes are public in this PR at commit56c390d567a249e498a906d1d162fe384593951e.approved=trueapplies to that exact design revision; implementation/proof review is a separate pass.102bf6b88108c5b1c8f3ed490e71a3fc). Delivered r103 content MD5334760f6fa500ab56076712ec3361e3aat commit0bcbd32160.The design doc (revision r103, commit
0bcbd32160, this head) now carries this traceability block in its section-11 review record. No protocol or decision changed; no review transcripts were added to the repository.Review repair #5 (2026-10-31, round-52 P2: bounded tombstone replay over compact retained deletes)
The mo-bot review on head
0bcbd32160(PRR_kwDOFEPiGM8AAAABVK_VDQ) flagged that the bounded change-range admission estimatorfillRowCols(pkg/vm/engine/disttae/logtailreplay/change_handle.go:5277) indexed a tombstone entry'sBatch.Vecs[2]unconditionally. Valid and in scope:PartitionState.HandleRowsDelete(partition_state.go:1026-1035) compacts every retained in-memory delete entry's batch to the lone PK vector (Vecs[:1]), so any bounded tombstone replay over retained deletes — including the link-cleanup tombstones this PR's MERGE/PICK provenance capture reads (engine.WithChangeRangeLimitatpkg/frontend/data_branch_pk_move_link.go:1790, admitted viadeferRangeLimitToAssembly) — panicked index-out-of-range in the admission pass before the writerfillInDeleteBatch(which already supports both layouts) saw the row. The bounded machinery is this PR's own addition.Fix (commit
fa82626050, this head): one shared delete-PK source selection,deleteEntryPKVec, now used by bothfillRowColsandfillInDeleteBatch, so the admission estimate measures exactly the vector the writer reads. No protocol change; this restores the estimator to the writer's existing compact/legacy contract.Proof:
0bcbd32160): the new test panics withruntime error: index out of range [2] with length 1atfillRowCols(change_handle.go:5277, the reviewed line), exit 1 (/tmp/issue-28026-r104/test-prefix.log)./tmp/issue-28026-r104/test-new3.log).TestDefaultPolicyTombstoneConstructionReadsCompactRetainedDeletesbuilds replay-produced compact deletes through realHandleRowsDeletereplay — pinning thelen(entry.Batch.Vecs)==1precondition — then drives the productionNewChangesHandlerunder an attachedChangeRangeLimit: an under-budget window (rows=4 of 8) is refused through the capacity class, proving the estimator charged the compact rows, and the admitted window drains the identical tombstone stream with the compact batch's PK/commit-TS values. The existing writer-only compact-layout test is retained unchanged../pkg/vm/engine/disttae/logtailreplaypackage green on this head (/tmp/issue-28026-r104/test-package.log), plus gofmt/git diff --checkclean.Base update + conflict resolution (2026-10-31, 4.0.19 hop merge with #31489)
Rebased onto
main8197e28bc6(old headfa82626050, new head6f2fa2ae5a). Upstream #31489 (information_schema COLUMNS/STATISTICS identity refresh for existing tenants) publishedpkg/bootstrap/versions/v4_0_19with two tenant entries at offset 2 andmin_upgrade_version4.0.7 — an add/add conflict with this PR's v4_0_19 package, which carried the two data-branch provenance catalogs at offset 2 behindmin_upgrade_version4.0.18. Resolution is a semantic union, not a side pick:MinUpgradeVersion4.0.7 (upstream's wider hop kept, so pre-4.0.18 sources reach the sysview refresh directly),VersionOffset4 (len(tenantUpgEntries)), handler floorMORPCVersion118.mo_data_branch_update_linkandmo_data_branch_link_retention— each catalog creation keeps its ownRequiredProtocolVersion: MORPCLatestVersionconvergence gate, so a tenant walk stalls those two entries asNotSupportedwhile any node reports an older binary, and converges after every node is current.4.0.19/offset 2 by fix(sysview): publish declared COLUMNS metadata, numeric SUB_PART and full generated expressions #31489 re-enter the same handler at offset 4 (the offset short-circuit re-fires the final version), run the two catalog creations exactly once, and the CheckFunc-gated entries keep completed tenants as no-ops. The framework's terminal-route rule for in-flight old-offset routes is unchanged.pkg/bootstrap/upgrade.go; the tenant-init integration oracle and the crossing/statistics/v4.0.7 suites resolve their expectations dynamically against the merged handler metadata.Test repairs on this head (
6f2fa2ae5a): the main-era shared-vehicle suite (columns_upgrade_test.go) advances its offset pins 2→4 in themo_versioninsert assertion and the handler-metadata check; the v4_0_19 package test now answers themo_ctl GetProtocolVersionprobe and gains a counterexample arm proving a sub-convergence node fails the catalog entry asNotSupportedwith zero catalog DDL executed, then converges and creates the table. No production gate logic changed in this turn beyond the merged hop metadata; design r103 remains the design of record (the hop metadata is outside its decision scope).Proof (this head):
go test ./pkg/bootstrap/...(all 21 packages incl. the parent service suites andversions/v4_0_19with the new gate arm) green; earlier same-head runs:versions/v4_0_195/5, parent package green after the offset realignment;go vet -tests=true ./pkg/tests/sqlintegration/clean; gofmt/git diff --checkclean. Live-cluster sqlintegration/BVT execution remains for CI.Review repair #6 (2026-10-31, round-53 P2: provenance-catalog protocol gates removed under the shutdown-upgrade contract)
The mo-bot review on head
6f2fa2ae5a(PRR_kwDOFEPiGM8AAAABVNIQQQ) flagged the twoRequiredProtocolVersion: MORPCLatestVersionfields the 4.0.19 hop merge had added to the data-branch catalog entries (pkg/bootstrap/versions/v4_0_19/tenant_upgrade_list.go) as policy-violating per-feature convergence gates. Valid and in scope; confirmed on the reviewed head:.agents/skills/mo-dev/references/upgrade-compatibility.mdforbids adding a per-featureMORPCVersiongate or extending existing gates for new features; MatrixOne supports shutdown upgrade only, so a tenant migration never faces a mixed-protocol cluster.UpgradeEntry.upgraderunscheckCommonProtocolVersionbefore the DDL (pkg/bootstrap/versions/upgrade_strategy.go:184-191), executingSELECT mo_ctl('cn', 'GetProtocolVersion', '')— a cluster-wide protocol RPC per affected tenant migration, with its failure dependency.c42cf402and that head both advertiseMORPCLatestVersion = MORPCVersion134(pkg/defines/const.go:172-173), so the threshold could not establish the claimed provenance capability.Fix: removed both entry gate fields and the matching rolling-restart/convergence claims from the comment blocks in
tenant_upgrade_list.go,v4_0_19/upgrade.go, andv4_0_19/upgrade_test.go. The inherited handler floor (MORPCVersion118) and the historical sysview entry gates (109/41) stand, per the same policy ("existing gates stay"). This corrects the corresponding claim in the base-update ledger entry above. No design deviation: design r103's D149 covers the catalog-creation upgrade path and idempotence, both unchanged.Proof:
pkg/bootstrap/versions/v4_0_19package green:TestHopEntryProtocolGates(renamed) now pins zeroRequiredProtocolVersionon both catalog entries while asserting the historical 109/41 gates stand;TestUpgradeLinkTableCreateAndIdempotencekeeps the declaration-order creation plus second-pass no-op proof; the removed counterexample arm had asserted the gate semantics the policy forbids.go test ./pkg/bootstrap/parent package green (shared-vehicle walk, crossing, v4.0.7 tenant, columns suites — the catalog entries now run gate-free inside those walks); gofmt andgit diff --checkclean.Review repair #7 (2026-10-31, Codex follow-up P2: design doc names the delivered v4_0_19 vehicle)
The Codex automated follow-up review on head
6f2fa2ae5a(COMMENT, 2026-10-30T20:27:13Z) flagged that the design doc still named the retired 4.0.8 design-time placeholder as the provenance catalogs' upgrade vehicle at three places (§3, §7's D149 prose, §10's validation anchor), while this branch ships them inpkg/bootstrap/versions/v4_0_19— documentation drift, explicitly non-blocking. Valid and in scope.Fix (commit
bff0b0a8fb, this head — editorial-only design r104): the three references now name the delivered v4_0_19 vehicle, its fold with upstream #31489's sysview identity refresh, and the realpkg/bootstrap/versions/v4_0_19test package; the D149 register entry already states the version-neutral forward-placement rule, so no register entry changed. The §3 gate claim class was also re-verified: r104 carries no convergence-gate assertion (repair #6). Delivered r104 content MD5db551261603f90bdab8204908758fd20; the §11 delivered lineage now records r104 = r103 + these placement corrections under the r100 approval of record.Base update + conflict resolution (2026-10-31, upstream #31488 consolidates 4.0.18/4.0.19 into 4.0.7)
Base advanced from
8197e28bc6to3f484ec428(upstream #31488 "refactor: consolidate unused code and duplicate responsibilities"). #31488 deleted the unpublishedv4_0_18/v4_0_19handler packages and folded every unpublished migration into the unpublished 4.0.7 handler (27 tenant + 14 cluster entries, offset 41); its contract (docs/design/20261028-catalog-upgrade-407.md) forbids registering the unpublished 4.0.8..4.0.19 identities as upgrade steps. That removed this branch's r104 v4_0_19 vehicle (offset 4), producing the merge conflict inpkg/bootstrap/upgrade.goand the shared-vehicle test files.Resolution (semantic; entry content preserved, vehicle re-derived):
mo_catalog.mo_data_branch_update_link,mo_catalog.mo_data_branch_link_retention, bothCheckTableDefinition-guardedCREATE_NEW_TABLEentries carrying no per-feature protocol gates) append to the tail of the unpublishedv4_0_7tenant entry list, raising the handler offset 41 → 43 (tenant 27 → 29, cluster 14 unchanged). The appended comment block records why the creations cannot register a new version identity.pkg/bootstrap/upgrade.gokeeps upstream's registration state (no v4_0_18/v4_0_19 imports or registrations). Branch-side expectations advance:service_upgrade_crossing_test.go(2×),service_upgrade_tenant_v407_test.go(1×) andservice_upgrade_snapshot_test.go(2×) expect4.0.7at offset 43;versions/v4_0_7/catalog_upgrade_entries_test.gopins 29 tenant + 14 cluster = 43.pkg/frontend/predefined.go(untouched by this PR). Main-era clusters stamped 4.0.7 at offset 41 are incompatible unreleased layouts:service_upgrade.go/custom_upgrade.gokeep rejecting the offset mismatch, the upstream-intended outcome ("incompatible unreleased-main catalog layouts are not supported upgrade sources").6f2fa2ae5a(v4_0_19 offset-pin realignment; upstream deleted the pinned shared-vehicle test with the package) andd4c309b6fe(removal of the v4_0_19 per-feature protocol gates; the carried entries already have no gate fields).versions/v4_0_7/pk_move_provenance_upgrade_test.go: handler metadata and tail-entry registration shape, zero per-entry protocol gates, declaration-order DDL execution with a second-pass no-op (retry-resume idempotence), and lifecycle error propagation.ae72d036d997c36b2462a0c8a59e93cfat commit47707f4159.Proof (this head
47707f4159):go build ./pkg/bootstrap/...green (CGO env per repo cgo layout).go test ./pkg/bootstrap/versions/v4_0_7/ -count=1 -run 'TestHandlerRegistersProvenanceCatalogTail|TestProvenanceCatalogEntryProtocolGates|TestProvenanceCatalogCreateAndIdempotence|TestProvenanceCatalogLifecycle' -v: 4/4 PASS.go test ./pkg/bootstrap/... -count=1: all 19 tested packagesok(parentpkg/bootstrapservice suites — crossing, snapshot, tenant-v407, columns — included; v1_2_1/v1_2_2 have no test files), zero FAIL.git diff --checkclean.Prior heads' broader-suite evidence (plan/txn/engine/disttae/frontend and service-level cells) is untouched by this conflict surface; live-cluster sqlintegration/BVT execution remains for CI.
CI repair (2026-10-31, UT Coverage on Ubuntu/x86: embed fail-fast gate literal)
CI run
41172437175(attempt 1) on head47707f4159failedMatrixone UT Coverage execution / UT Coverage on Ubuntu/x86:pkg/embed'sTestColumnsUpgradeManualFailFastThenCompleteasserted the pre-resolution gate messagecatalog version 4.0.6/5 is not ready for 4.0.7/41; ..., while the rebased handler's final offset is 43 (... 4.0.7/43). Caused by this PR: the base-update resolution above advanced the crossing/snapshot/tenant-v407/catalog-entries pins 41 -> 43 but missed this hardcoded literal inpkg/embed/upgrade_metadata_test.go(the v4_0_19 vehicle had kept 4.0.7 at offset 41 on earlier heads, so the literal matched until the rebase).Fix (test-only): the fail-fast assertion and the two comment pins naming the same final target advance to
4.0.7/43. Every otherpkg/embedrecovery assertion readsv4_0_7.Handler.Metadata()dynamically and was already green on this head. A repo-wide sweep confirms no remaining4.0.7/4xor offset-41 pins outside this line.Proof:
124453127117log records the exact assertion diff (4.0.7/43observed vs4.0.7/41expected); the same run shows every otherpkg/embedtest passing (single failed test event + package aggregate).go test ./pkg/embed -run '^TestColumnsUpgradeManualFailFastThenComplete$' -count=1 -vPASS on the fixed tree (exact CI-failing selection; retained executable, CGO env per repo cgo layout).Review repair (2026-11-02, fengttt: vectorized key encoding + fix-strategy writeup)
Review (
CHANGES_REQUESTED) asked for the fix strategy in the PR text (now the "Fix strategy (the idea)" section above) and, onpkg/container/vector/encode.go, questioned why this PR adds an Encode API and asked for a vectorized API instead of per-row type dispatch.Why the API exists:
mo_data_branch_update_linkkeys must compare byte-for-byte with the data-branch hash-map keysfrontend/databranchutilsalready materializes viatypes.Packer, and this PR adds engine-side readers/writers of those keys inpkg/vm/engine/disttae, which cannot importfrontend. The pre-existing per-cell Packer switch moved unchanged out ofbranch_hashmap.gointopkg/container/vector-- the lowest layer that sees bothVectorandtypes.Packer. A code motion of the existing encoding, not a new encoding.Vectorization (
438b247979):NewRowEncoder(vec)resolves the vector's type once and returns a boundRowEncoderwith the typed column slice captured per arm; every row loop that called the per-row API (data_branch_hashdiff.go5 sites,data_branch_pick.go,multi_update/pk_move_link.goold+new key pair,disttae/pk_move_link_fixup.go8 sites) now binds once per vector.EncodeRowToPackerremains as the single-row entry point over the same dispatch core (one genuinely one-off encode in the fixup and the pre-existing multi-column hash-key path inbranch_hashmap.go). Behavior and produced bytes are unchanged.Proof:
pkg/container/vector/encode_test.go--TestNewRowEncoderMatchesEncodeRowToPacker(all 25 type arms, per-row equality against the previous API) andTestNewRowEncoderConstVector(const fixed/varlena vectors encode row 0's payload at any index, matching the clamped per-row API) PASS; the pre-existing byte-compat pins indata_branch_pk_move_link_test.goandmulti_update/pk_move_link_test.gopass unchanged.BenchmarkRowEncoderBoundVsPerRowon 8192 int64 rows -- bound encoder 161312 ns/op vs per-row dispatch 764538 ns/op (~4.7x) per full-vector pass.go test ./pkg/container/vector, plus the pk-move/link selections of./pkg/frontend,./pkg/frontend/databranchutils,./pkg/sql/colexec/multi_update,./pkg/vm/engine/disttae(CGO env per repo cgo layout).Review repair (2026-11-02, mo-bot-local P2: per-cell encoder allocation in the remaining hash-map loops)
The
mo-bot-localreview (CHANGES_REQUESTED, 2026-11-02T04:04:56Z) confirmed a performance regression:branch_hashmap.go's unconverted loops still reached the scalarEncodeRowToPackerwrapper per cell, adding 24,576 allocations perBenchmarkPutByVectors/serialcall and 8,192 perBenchmarkGetByVectors/serialcall (~13% median time on both) versus the pre-PR scalar implementation. Valid and in scope.Fix (
f1f029afe2):branch_hashmap.gogainsbindRowEncoders, which binds onevector.RowEncoderper selected column once per API call;PutByVectors,PopByVectorsStreamandlookupByVectorsnow encode keys/values through the bound encoders inside their row loops, with the same null handling and byte format asencodeRow. The scalarEncodeRowToPackerremains the single-row entry point (disttae pk-move-link fixup); the package's scalarencodeRowis now test-only.Proof:
TestBindRowEncodersMatchEncodeRow(4-row vectors, 10 type arms + constant column + null row) asserts bound-encoder bytes equalencodeRowbytes for every row;TestEncodeRowCoversManyTypesand theTestBranchHashmap*roundtrip suites pass unchanged (47 focused tests PASS).BenchmarkPutByVectors/serial: 57,426 → 32,856 allocs/op (−24,570); median 4,777,866 → 4,078,876 ns/op (−14.6%).BenchmarkGetByVectors/serial: 65,603 → 57,414 allocs/op (−8,189); median 2,908,171 → 2,529,042 ns/op (−13.0%).Review repair (2026-11-02, aunjgr + mo-bot-local P2: out-of-window straddler commit poisons a valid child anchor)
Two reviews on head
f1f029afe2raised the same finding: aunjgr (inline onpkg/frontend/data_branch_pk_move_link.go:1074, threaddiscussion_r4440846584) andmo-bot-local(CHANGES_REQUESTED, review 5734858890). The provenance probe reads the apply statement's current snapshot with onlywrite_ts <= endPhys, wherewrite_tsis the recording transaction's CREATE time, so an ancestor transaction begun before a fork but committed after its lineage window ended is visible to that window's probe;mergeProbedLinksLockedthen poisons the shared(old row id, old pk)identity before stream commit-membership screening can exclude it, and a conflict-free MERGE aborts. Verified valid and in scope. Every manifestation is a fail-closed abort (D51 unresolved-verdict route; birth-certificate binding bars a misattributed fold), so there is no wrong-data exposure.Reproduction (deterministic fabric, scratch probe on the pre-fix head): two windows (P segment [10,30] on table 88, S segment [30,50] on table 99) with X's straddler link (oldRowID R, 1->2, write_ts=20, committed t40) admitted through the unanchored P-window probe and Y's in-window link (R, 1->3, write_ts=35) through the S-window probe —
byRowProbeVerdictreturnshit=false, complete=false, poisoned=true, the walk resolvespkMoveUnresolved, and the apply aborts. Log: r106-straddler-repro.log (loop artifacts).Design revision r106 (
367c154a2f, this branch; new decision D223 indocs/design/20261016-data-branch-pk-move-update-provenance.md): every provider-window catalog read — the whole-window scan, the per-key overflow fallback, and the LIMIT-1 existence probe — is snapshot-anchored at the window's full end timestamp via{MO_TS = '<phys-logical TS>'}(the D222 anchor form), so each probe exposes exactly the links committed at or before its window's end. Sufficiency without per-window cache attribution: the link_id prefix range already restricts each probe to the window's physical table, and on a linear lineage an in-window move retires its (row id, old pk) occupant from every descendant's inherited state, so after anchoring two different visible links can share one row identity only through genuinely ambiguous catalog evidence — the poisoning path stays fail-closed for exactly that case. A window whose end predates the link catalog's creation in its owner account degrades to complete absence (anchored existence check extending D220 (B.4)); empty-endfixtures keep the unanchored posture; the PICK key-closure probes keep the wider unanchored read because over-admission there only widens the dependency-key set while every fold decision stays behind the anchored, membership-screened walk.Status: per the repository design gate this changes documented decisions (the D11/D24 bounds), so implementation — including the requested multi-generation/sibling regression with a transaction begun before the fork but committed after it — waits for independent design approval of r106. The aunjgr thread carries the same disposition (
discussion_r4441170201).Design-review outcome (2026-11-02): the independent design review of r106 returned REQUEST_CHANGES (P2): D223's
{MO_TS = window.end}reads of the link catalog require retained historical storage versions that no protection channel covers — TN's all-snapshot protection names only the three core catalog tables, table-level snapshots propagate only to non-system tables of the same database (system tables are skipped), and the mo_catalog PITR channel carries only user-created PITRs, so catalog-object rewriting and reclamation could remove the very version an anchored read queries while its logical links remain live. No CN-expressible protection mechanism exists, and establishing one in TN is outside this PR's scope. r106 was never implemented.Design revision r107 (
366934c7fc, this branch; D223 withdrawn, new decision D224 indocs/design/20261016-data-branch-pk-move-update-provenance.md): the repair no longer reads any historical catalog state. Provenance probes keep the unanchored current-snapshot posture; probed links keep their per-(table, window) attribution; and identity conflict checking is deferred until commit membership is established through the D156 scope-to-commit capture — a candidate whose recording transaction committed outside every collected window of this source lineage (the straddler) is excluded before identities compare, so it can neither bind nor poison an anchor. Only membership-admitted candidates enter the identity comparison (zero = proven absence, one = bind, distinct duplicates = fail-closed poison). Section 9.3 gains the storage-version retention audit; the section 10 validation map gains the demanded lifecycle scenario (table-scoped branch protection only, no account/cluster snapshot or PITR, catalog rewriting/reclamation, restart, exact MERGE/PICK cascade assertions). Status: submitted for fresh independent design approval; implementation — including the multi-generation/sibling regression and the lifecycle battery — waits for that approval.Design checkpoint (2026-11-02, r107 review outcome + r108 revision)
Design-review outcome (2026-11-02): the independent design review of r107 returned REQUEST_CHANGES with two findings, both verified valid against the reviewed head. (P1) D224(f)'s singleton exemption lets a single membership-unscreened candidate start and resolve a chain: on the schedule "fork D from P at t10; X begins on P at t20; fork S at t30; X moves the inherited row 1->2 and commits at t40; S independently DELETEs 1 and INSERTs an unrelated 2 in one transaction at t50", only X records a link, its out-of-window link becomes the singleton candidate for S's tombstone, and the walk's claim step binds a stream birth to that link by birth instant alone — it never compares the claimed row's identity to the link's durable new row id (and cannot: the commit pipeline strips workspace rowid vectors, so durable row ids exist only after TN precommit). The destination still holds key 1, the output count guard passes, and the apply executes an UPDATE that cascades children onto the unrelated row. (P2) D224's membership capture still depends on the link catalog's unprotected change history — the same reclamation gap that invalidated D223 — so after ordinary catalog rewriting and reclamation a valid, fully retained branch can no longer resolve, and r107 had re-pointed the lifecycle oracle at accepting that abort.
Design revision r108 (
6a31f5197f, this branch; D224 superseded before implementation, new decision D225 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD5d92a3043d0048b73cc15e5fbeb3bc2ab): preserved commit-exact provenance. The link table gainscommit_ts binary(12) null(the fulltypes.TSbyte form of the recording transaction's commit instant — physical bits alone cannot order two commits inside one physical instant), added in place to the unpublished 4.0.7 upgrade entries and the predefined DDL. The writer stages NULL; a CN-side commit-completion step — the point where the CN first observes the TN-assigned commit timestamp — stamps exactly that transaction's staged link rows by link id in one small bounded internal transaction; stamping failure or a crash leaves NULL. The resolution walk admits a candidate at a departure instant T only when the candidate's storedcommit_tsequals T: exact-transaction binding through I7 atomicity plus the one-committed-row-per-key stream facts, with no singleton exemption. A NULLcommit_tson a needed candidate means unprovable provenance and takes the loud D51/D56 abort — never proven absence, never a silent legacy downgrade. A mismatched candidate is excluded before any identity comparison, so the straddler can neither bind nor poison an anchor; zero admissible candidates is proven absence (legacy replay semantics, including the P1 counterexample's plain DELETE); two distinct admissible candidates on one row identity is genuinely ambiguous catalog evidence and fails closed loudly. Because the admitted instant is a collected stream entry by construction, commit-window membership is subsumed and the D156 scope-to-commit change-stream capture is retired from every resolution path — no reader depends on reclaimable catalog history, and the link's D13 lifetime equals the protected stream's lifetime. PICK never consultscommit_ts. The lifecycle oracle is restored: exact MERGE/PICK pk-move cascade assertions after catalog rewriting/reclamation and restart on otherwise valid retained branches; loud aborts are asserted only for genuinely incomplete evidence (unstampedcommit_ts, truncated stream). Section 9.3 marks the capture's reader class removed; the section 10 validation map gains the demanded singleton-straddler + independent DELETE/INSERT scenario for MERGE and PICK (asserting DELETE semantics, FK rejection, and unchanged destination parent/child rows) alongside the commit-gate unit and fabric tests. Status: submitted for fresh independent design approval; implementation — including that regression battery and the lifecycle scenario — waits for that approval.Design checkpoint (2026-11-02, r108 review outcome + r109 revision)
Design-review outcome (2026-11-02): the independent design review of r108 returned REQUEST_CHANGES with two findings, both verified valid against the reviewed head. (P1) D225(d) treated
commit_tsequality with the departure instant as sufficient window membership and discarded per-window attribution — but windows are relation-specific (pkg/frontend/data_branch.go:2628-2653), and one RC transaction begun before a fork advances its snapshot per statement (handleRCSnapshot,pkg/vm/engine/disttae/types.go:2022-2031), so it can perform the ancestor move AND the sibling's independent DELETE/INSERT in a single commit: the ancestor link'scommit_tsequals the sibling anchor's departure instant while lying outside the ancestor window's[start, end], the equality-only gate admits it, the claim binds the sibling's unrelated row by birth time alone (data_branch_pk_move_link.go:3246-3301), and the destination count guard passes (data_branch_output.go:2200-2241) — a wrong UPDATE cascade. Transaction identity does not establish which table's operation a link records. (P2) r108's two-step publication (commit first, stamp later) left a durable gap: a stamping failure, its cancellation, a CN crash in the stamping window, or a lost commit response (FinalizeCommitWithUnknownResult,pkg/vm/engine/disttae/txn.go:4004-4011) leavescommit_tsNULL permanently, and r108 made that state abort forever — an otherwise valid committed branch permanently losing MERGE/PICK provenance after a transient failure — while the completion event joins callback errors into the post-commit result path (pkg/txn/client/operator.go:1187-1191), leaving the user-visible COMMIT-result semantics unclosed.Design revision r109 (
21a42804a3, this branch; D225 amended before implementation, new decision D226 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD5f6698dc5b4a1151fa244dce6712db387): windowed commit-exact admission and durable stamp recovery. (a) Per-(table, window) candidate attribution is restored: each hop consults only the candidate pool of the window whose stream carries that hop's departure tombstone, and conflict checking happens only among that one pool's admitted candidates. (b) Admission now requires BOTH that a candidate's storedcommit_tsfalls inside its own attributed window's[start, end]AND that it equals the departure instant, checked before any identity comparison or arrival attribution — the one-transaction cross-branch counterexample fails window membership (the ancestor's segment of this lineage ended before the single commit), the classic straddler fails equality, and a valid in-window move passes both; the arrival tie is amended identically. (c) NULLcommit_tsis a durable stamp-pending intent, not a terminal state: resolution heals it lazily from the protected per-window user-table stream the walk already collected — the linkedold_row_idversion dies exactly once in its physical table's committed stream, and I7 ties the link to that commit, so the death's instant IS the recording transaction's commit instant; a workspace-placeholderold_row_idinherits the instant from any stream-bound or stamped link of the same transaction; exactly one in-window death heals, no in-window death excludes, and a duplicate death, an unbound placeholder chain, or a truncated/disabled stream fails loudly. A healed candidate is best-effort re-stamped by one small bounded internal transaction. (d) The eager commit-completion stamping is best-effort and never alters the user-visible COMMIT result — the stamping callback swallows and logs its own failures; lost commit responses, cancellation, crash, and restart all land on the same NULL-heals lane, and a rolled-back move commits no links and no stream entries (I7), so no provenance outlives its move. Loud aborts remain only for genuinely incomplete or ambiguous evidence — no permanent NULL-induced aborts remain. Thecommit_tscolumn, the CN stamping hook, the D156 capture retirement, the equality binding, the no-singleton-exemption posture, and PICK's wider unanchored read all stand from D225. Section 10's validation map gains the window-mismatch gate assertions, the review's demanded one-transaction ancestor-move + sibling DELETE/INSERT oracle for MERGE and PICK (asserting DELETE semantics, FK implicit-RESTRICT rejection, and unchanged destination parent/child rows), the recovery unit tests, and deterministic crash/failure checkpoints (stamping failure, cancellation, crash between commit and stamping, lost commit response, restart — each followed by exact MERGE/PICK cascade assertions for committed moves, with rollback leaving no provenance). Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r108 was never implemented.Design checkpoint (2026-11-02, r109 review outcome + r110 revision)
Design-review outcome (2026-11-02): the independent design review of r109 returned REQUEST_CHANGES with two findings, both verified valid against the reviewed head. (P1) D226's recovery rule classified every non-workspace
old_row_idas a committed stream-bound version and excluded a NULL-stamped candidate with no in-window death — but uncommitted S3 rows also carry non-workspace object identities, and their same-transaction deletes are diverted without publishing a tombstone (pkg/vm/engine/disttae/txn.go:2544-2569: the delete lands in the per-block list, the batch is shrunk, and the object is rewritten minus the row at commit). Under a stamping failure, the second hop of an S3-netted chain — the emc schedule (test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:879-907): one transaction moves 2->1000->1001 through a forced small-object flush and independently reinserts 1000 — is wrongly excluded; the terminal timestamp claim then adopts the unrelated reinserted row born at the chain instant (data_branch_pk_move_link.go:3206-3301), the destination count guard passes (data_branch_output.go:2200-2241), and the apply cascades onto the impostor key 1000 instead of the lineage's final key 1001. (P2) The recovery rule text excluded a candidate with no in-window death while the soundness argument and section 5.3 classified the same shape (no death, no bound sibling) as a loud abort — an unstamped successor committed after a historical endpoint (test/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:822-855) would abort the apply and block the valid earlier in-window move, contradicting D226's own promise that out-of-window candidates cannot poison valid applies; the stamped form already resolves by ending the lineage at the claimed version (the terminal exclusion path,data_branch_pk_move_link.go:3303-3322).Design revision r110 (
0753e7d994, this branch; D226 amended before implementation, new decision D227 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD58a2707597ff83f06a6cf2634a79cfdb0): a single recovery outcome table, with transaction-bound stamp recovery extended to netted S3 object identities. Recovery resolves every NULL-stamped candidate to exactly one of four rows: (a) HEAL — the linked stream-bound version's unique in-window death is the recording transaction's commit instant (a rowid dies once; I7 ties the link to that commit), riding the same protected per-window stream the walk already collected; (b) INHERIT — a transaction-local identity (a workspace placeholder OR an uncommitted S3 object identity reached through the transaction's own recorded continuity, scope equality bytxn_id/write_ts) takes the commit instant of any admitted same-transaction sibling, one transaction one commit instant; a missing death carries NO window information for this class — the row never publishes a tombstone regardless of when its transaction commits — so window absence is never inferred from it, the established continuation checks and per-(table, window) attribution are preserved, and the two-condition gate still evaluates the inherited instant against the candidate's own window; (c) EXCLUDE — proven window absence: stream-bound identity, NF5-complete stream, no in-window death, so the recording transaction provably did not commit this move inside the window; never loud, never heals into a window — an unstamped successor committed after a historical endpoint and an unstamped cross-fork straddler both land here, so the valid in-window move the walk already holds still cascades, exactly the stamped path's verdict; (d) ABORT LOUDLY — incomplete or corrupt evidence only: a truncated/disabled stream, a duplicate in-window death, or an unbound transaction-local candidate. A healed or inherited candidate is best-effort re-stamped. The same-transaction continuation now records both shipped chain forms (identity-chained through the workspace placeholder; key-chained through the transaction's recorded S3-route departure, screened against foreign vacate-before-arrival departures by the in-window tombstone), and section 5.1's NULL-identity bullet is aligned with the recorded S3 continuity (D32/D49/D50, D75-D81). The D226 windowed admission gate, the best-effort publication protocol with the closed COMMIT-result rule, the rollback-no-provenance posture, and the no-historical-catalog-reader posture all stand; recovery still adds no reader class and no storage dependency. Section 10's validation map gains the review's demanded MERGE/PICK stamping-failure and crash twins of both S3-chain scenarios (asserting the exact child key — the cascade lands on the lineage's final key — and the preservation of the unrelated intermediate row as its own plain insert), the NULL-stamped future-successor and cross-fork cases requiring the valid in-window move to cascade, and the outcome-table recovery UTs (inherit when chained, exclusion never inferred from a missing death, unbound transaction-local loud). Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r109 was never implemented.Design checkpoint (2026-11-02, r110 review outcome + r111 revision)
Design-review outcome (2026-11-02): the independent design review of r110 returned REQUEST_CHANGES with two findings, both verified valid against the reviewed head. (P1) D227(d)'s key-chained continuation established continuity from same transaction, same key, and an absent tombstone — which cannot distinguish the landed generation's own departure from an EARLIER unrelated departure of a different holder: one transaction inserts an unrelated row B at 1000, spills it to an uncommitted S3 object, moves B 1000->1001 (the delete is diverted per
pkg/vm/engine/disttae/txn.go:2544-2569and publishes no tombstone), then moves A 2->1000 with an identity-less S3 replacement. Both links survive the commit fixup (B's death at 1000 predates A's staging statement, so the fixup'sod < birthpost-mortem rule ignores it —pkg/vm/engine/disttae/pk_move_link_fixup.go; B's replacement survives); D227 heals A's link at the death of 2, lets B's link inherit that same instant, and the walk's key-chain rule (pkg/frontend/data_branch_pk_move_link.go:3224-3234) follows B to 1001 instead of ending A at 1000 — the destination count guard passes (data_branch_output.go:2200-2232) and children cascade onto the unrelated B. The existing vacate-before-arrival coverage uses a committed B (merge_foreign_key_pk_move.sql:1055-1084) whose tombstone masks the uncommitted form. (P2) The submitted public acceptance projection's limitations preserved the rejected r109 reading — a stream-bound candidate with no unique in-window death on retained evidence classified as unprovable provenance that aborts loudly — contradicting the same projection's own exclusion semantics and D227(c)'s proven-window-absence row.Design revision r111 (
235ce8b9c0, this branch; D227's continuation rule amended before implementation, new decision D228 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD550c2b585bd8ee410ee9b05c9634508c4): recorded same-transaction continuity. Over the converged post-prune link set of one committing transaction, the commit-time fixup pairs each retained link arriving at a key with the same-transaction retained link departing that key at the smallest later statement ordinal — sound by the fixup's own invariants (one row per key per committed instant; prune-on-unexplained-death with its fixpoint; theod < birthpost-mortem rule), so the smallest later departure is the arriving row's own and an earlier unrelated departure of a different holder can never pair with a later arrival. The pairing is persisted on the link row: newsucc_link_id binary(64) null(computed unconditionally at commit, so a D228-era NULL always means TERMINAL, never unknown) andstmt_seq bigint unsigned not null, riding the same unpublished 4.0.7 tail upgrade entry and the predefined DDL (the table is unshipped; a pre-column shape stays an unreleased dev layout under the offset hard-error rule). The walk follows ONLY the recorded pairing: one exactlink_idpoint probe, verifying presence, scope equality (txn_id/write_ts),old_pkequal to the runningnew_pk, and strictly greaterstmt_seq, with the workspace-identity match and the tombstone screen demoted to consistency cross-checks whose contradiction is corrupt evidence failing loudly, and a NULL pairing coexisting with a retained later same-transaction departure failing loudly. One mechanism covers the workspace-placeholder and S3-netted forms alike (pairing keys on the transaction's statement ledger, not on any replacement identity), stamp-independent, so it holds for stamped and stamp-pending links alike; the r110 key-chain acceptance is retired, and the cycle guard still applies to pairing-followed hops. In the review's schedule B's departure statement precedes A's arrival statement, so A's link pairs with nothing, A's chain ends at 1000, A's child cascades onto A's row at 1000, and unrelated B remains at 1001 as its own plain insert — stamped and stamp-pending alike. The credential travels inside the live link row (section 9.3 class (a)): chain resolution after catalog rewriting, reclamation and restart follows the same recorded pairs, adding no reader class and no storage dependency. The D226 windowed admission gate, the D227 recovery outcome table (heal / inherit / exclude on proven window absence / abort only on incomplete or corrupt evidence), the best-effort publication protocol with the closed COMMIT-result rule, the rollback-no-provenance posture, and the no-historical-catalog-reader posture all stand. Section 10's validation map gains the review's demanded MERGE and PICK twins of the uncommitted vacate-before-arrival schedule, each in a stamped form AND a stamp-pending form (asserting A's child ends at the target key and unrelated B remains at its own final key), plus fixup pairing-persistence UTs (smallest-later-departure pairing over the converged post-prune set, terminal NULL recorded unconditionally, stamp independence) and walk UTs (only the recordedsucc_link_idfollowed; scope/key/ordinal verification; cross-check contradictions loud; NULL-pairing-with-later-departure loud). The public acceptance projection restates its limitation as the four outcomes consistently — a unique in-window death heals, proven window absence excludes, proven transaction-local continuity inherits, and only incomplete, corrupt or unbound evidence aborts — with no blanket no-death abort. Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r110 was never implemented.Design checkpoint (2026-11-02, r111 review outcome + r112 revision)
Design-review outcome (2026-11-02): the independent design review of r111 returned REQUEST_CHANGES with one finding, verified valid against the reviewed revision. (P2) r111 recorded that the cycle guard applies unchanged to pairing-followed hops, so a pairing-followed hop landing on ANY previously visited key fails closed — but D228 itself pairs the two links of a one-transaction
2->3->2return (the first link's arrival at 3 pairs with the second link's departure of 3 at the greater statement ordinal), and the pairing-followed hop lands on the already-seeded anchor key 2, so the specified guard aborts a valid apply, contradicting retained D70 (a PROVEN same-transaction return to the original key resolves). Verified at the cited loci: the shipped parser rejects only strictly backward birth certificates and continues equal-certificate homecomings (pkg/frontend/data_branch_pk_move_link.go:3148-3161,:3173-3178); the shipped success oracles prove returns resolve (pkg/frontend/data_branch_pk_move_link_test.go:1420-1469— the2->3->2and2->3->4->2walk cases;test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:1514-1561andtest/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:1088-1133— the changed/unchanged-payload MERGE and PICK homecomings). A single lineage returning home is distinct from a multi-row key rotation. The review confirmed the r110 findings are addressed by D228's recorded pairing.Design revision r112 (
fc2ffa78a4, this branch; D228's revisit clause amended before implementation, new decision D229 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD59399a6cb655c022c088595230cb553e4): proven same-transaction returns through the recorded pairing resolve. (a) A verified pairing-followed hop landing on the lineage's own previously visited key is a PROVEN return and continues under the parser's birth-certificate order: scope equality fixes one transaction and one commit instant (an EQUAL certificate is D70's homecoming; a strictly newer certificate is a return to a key the lineage itself vacated in an earlier generation, reached at the recording transaction's own instant), the strictly greaterstmt_seqproves the recorded links progress, and a strictly backward certificate fails closed as corrupt evidence. (b) Termination holds with repeated keys:stmt_seqstrictly increases on every pairing-followed hop and is bounded by the committing transaction's statement count, and the hop cap bounds the whole walk regardless. (c) The terminal link's NULL pairing ends the chain at the returned key; the claim accepts the re-birthed row born at the chain instant; the fold planner'soldKey == finalPKpath folds a changed payload as an in-place update and an unchanged payload as a no-op (D66 — a return to the original key is plan shape, never a rotation cycle). (d) A true multi-row key ROTATION (distinct rows exchanging keys in one transaction) still resolves each row's own walk — recorded pairings cannot cross rows — and the fold planner rejects the exchange as a rotation cycle (D57); non-pairing cross-key revisits keep the existing fail-closed posture, same-key tail re-entries exempt. Section 10 carries the existing changed/unchanged-payload MERGE/PICK return-home success oracles into the persisted-pair validation plan — MERGE and PICK twins of the one-transaction2->3->2return, each in a stamped form AND a stamp-pending form (stamping-failure injection), with the persisted pairing asserted (the first link pairs to the second, the last records terminal NULL) — plus walk UTs (a verified pairing hop onto the lineage's own visited key with progressingstmt_seqresolves; a strictly-backward certificate fails loudly; the hop cap still bounds; the two-row rotation exchange still aborts at planning). The public acceptance projection preserves the proven-return behavior. The D226 windowed gate, the D227 outcome table, the D228 pairing mechanism and credential, the publication protocol with the closed COMMIT-result rule, and the no-historical-catalog-reader posture all stand. Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r111 was never implemented.Design checkpoint (2026-11-02, r112 review outcome + r113 revision)
Design-review outcome (2026-11-02): the independent design review of r112 returned REQUEST_CHANGES with one finding, verified valid against the reviewed revision. (P2) r112 admitted revisits only through recorded same-transaction pairings or same-key tails, so two SEPARATELY committed updates
2->3at T1 then3->2at T2 > T1 abort when the cross-transaction departure returns to the seeded anchor key 2 — contradicting retained D66, whose approved r100 text (commit56c390d567a249e498a906d1d162fe384593951e, lines 2040-2054) explicitly requires exactly this schedule to resolve "through the advancing-timestamp chain into one fold whose departure and arrival share key 2" as an in-place UPDATE (changed payload) or no-op (unchanged payload). Verified at the cited loci (the deciding code is unchanged from r111): the walk binds the departure to the lineage's own landed version through the departed-birth-pinned pairing index (pkg/frontend/data_branch_pk_move_link.go:2879-2929), advances the birth certificate at every cross-transaction hop (:3381-3393), rejects only strictly backward certificates on revisit (:3173-3178, with the later-certificate cross-transaction return documented at:3148-3161), resolves the terminal claim at the chain instant (:3290-3301), and aborts an unresolved destination-held anchor (:3241-3244); the fold planner excludes the self-dependency (pkg/frontend/data_branch_hashdiff.go:3423-3435, whose comment names the two-committed-moves2->3->2shape); the shipped MERGE/PICK success oracles cover the separate-transaction changed/unchanged-payload returns (test/distributed/cases/git4data/branch/merge/merge_foreign_key_pk_move.sql:1431-1476,test/distributed/cases/git4data/branch/pick/pick_foreign_key_pk_move.sql:1006-1051). The review confirmed the same-transaction homecoming repair (D229) is coherent.Design revision r113 (
d7233b8136, this branch; D229's revisit clause amended before implementation, new decision D230 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD5930c9c0645ff3e961b76e13347b14369): proven cross-transaction returns with strictly advancing birth certificates resolve under the windowed admission gate. (a) A hop landing on a previously visited key follows the parser's birth-certificate order for EVERY hop class: a STRICTLY BACKWARD certificate fails closed as corrupt evidence (unchanged); an EQUAL certificate continues only through the verified recorded same-transaction pairing (D229's homecoming); a STRICTLY NEWER certificate continues through any proven channel — the verified recorded pairing, a same-key tail re-entry, or an ATTRIBUTABLE cross-transaction departure: the departed-birth-pinned pairing index serves the hop only when the departure tombstone names the lineage's own landed version (departed birth equals the running certificate), and the successor link passes D226's windowed admission gate (itscommit_tsequals the departure instant AND falls inside its own attributed window) — so the lineage itself returns to a key it vacated earlier (the separately committed2->3->2and the longer attributable2->3->4->3forms, D66's approved semantics). A FOREIGN row's departure is never attributable: its departed birth differs from the running certificate, the pairing index never serves it to this walk, the claim finds no row born at the chain instant, and the walk fails closed — the unproven cross-transaction reincarnation posture is unchanged. (b) Termination holds: cross-transaction hops strictly advance the commit instant (one transaction, one commit instant over the committed stream), pairing-followed hops strictly advancestmt_seqwithin the committing transaction's statement count, same-key tails strictly advance the instant, and the hop cap bounds the whole walk regardless. (c) The terminal claim accepts the re-birthed row born at the chain instant; the fold planner'soldKey == finalPKpath folds a changed payload as an in-place native UPDATE and an unchanged payload as an in-place no-op (D66); a genuine multi-row key ROTATION still resolves each row's own walk — recorded pairings cannot cross rows, and a cross-transaction hop binds only the lineage's own landed version — and the fold planner rejects the exchange (D57). Section 10 retains the separate-transaction changed/unchanged-payload MERGE/PICK return successes (each additionally run in a stamp-pending form with the window-admitted successor asserted), gains new MERGE and PICK twins of the attributable2->3->4->3return (changed and unchanged payloads, stamped AND stamp-pending), and gains walk UTs (an attributable cross-transaction revisit with a strictly advancing certificate resolves; the same hop with the successor outside its attributed window fails closed; a foreign row's departure at the vacated key is never followed; a strictly-backward certificate fails loudly; the hop cap bounds; the rotation exchange still aborts at planning). The public acceptance projection admits the proven cross-transaction return. The D226 windowed gate, the D227 outcome table, the D228 recorded-pairing mechanism and credential, and the D229 equal-certificate homecoming all stand. Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r112 was never implemented.Design checkpoint (2026-11-02, r113 review outcome + r114 revision)
Design-review outcome (2026-11-02): the independent design review of r113 returned REQUEST_CHANGES with one finding, verified valid against the reviewed revision (r113 at
d7233b8136, doc content MD5930c9c0645ff3e961b76e13347b14369). The review confirmed the D230 admission rule addresses r112, and found: (P2) r113's fold-shape text (section 5.2(iii), the section-10 validation row, D230(c)/(e), and the submitted public projection) prescribed an in-place no-op for an unchanged payload on EVERY proven cross-transaction return to a vacated key — but the attributable2->3->4->3chain ends at an INTERMEDIATE vacated key 3 while the destination anchor holds key 2 (finalPK != oldKey), so the primary key still changes and the destination must become parent(3,'two')with the child cascading toparent_id=3; approved r100 D66 (commit56c390d567a249e498a906d1d162fe384593951e, lines 2040-2061) permits a no-op only for an identical final image at the ORIGINAL key. Verified at the cited loci (unchanged shipped code): the fold planner preserves the original and final keys separately (pkg/frontend/data_branch_hashdiff.go:3384-3391) and the emitter writes the native UPDATE assigning the final key through the original-key predicate (pkg/frontend/data_branch_output.go:2265-2289), so r113's acceptance oracle would have validated the wrong destination state.Design revision r114 (
c396dcd7f8, this branch; D230's fold-shape clauses amended before implementation, new decision D231 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD56b8876d1be0a0739c2193e1cc99a5c22): the fold shape of a proven return is decided by WHERE the chain ends. (a) A return to the ORIGINAL anchor key (the separately committed2->3->2; finalPK == oldKey) keeps D66's homecoming shape — a changed payload folds as one in-place native UPDATE and an unchanged complete image folds as an in-place no-op. An attributable return to an INTERMEDIATE vacated key (the separately committed2->3->4->3ending at key 3 with the anchor at key 2; finalPK != oldKey) is an ordinary move fold — ALWAYS a native UPDATE assigning the final key through the original-key predicate in BOTH payload forms, because the primary key itself changes and destination children cascade onto the final key; the rule is complete over every proven-return hop class (a same-transaction2->3->4->3through the recorded pairing folds the same way), and a genuine multi-row key rotation still resolves each row's own walk and aborts at fold planning (D57). (b) D230's admission rule is untouched — the three-way birth-certificate order, the attributable-departure binding, the windowed gate, and the fail-closed posture for foreign departures stand exactly as r113 recorded them. (c) Section 10 splits the demanded oracles: the retained separate-transaction2->3->2MERGE/PICK successes (changed payload folds as a native UPDATE at key 2; unchanged complete image applies as an in-place no-op keeping the exact original rows; each in stamped AND stamp-pending forms) are joined by new MERGE and PICK KEYS(2) twins of the attributable2->3->4->3return asserting the native UPDATE2->3with the EXACT parent key-3 row and the child atparent_id=3for BOTH changed and unchanged payloads (the no-op expectation is reserved for an unchanged complete image returning to the original key), each in stamped AND stamp-pending forms; walk UTs assert the2->3->4->3chain terminates at intermediate key 3 with finalPK != oldKey (a move fold, never a homecoming no-op) alongside the carried admission battery (an attributable cross-transaction revisit with a strictly advancing certificate resolves; the same hop with the successor outside its attributed window fails closed; a foreign row's departure at the vacated key is never followed; a strictly-backward certificate fails loudly; the hop cap bounds; the rotation exchange aborts at planning). (d) The public acceptance projection distinguishes the two fold shapes. The D226 windowed gate, the D227 outcome table, the D228 recorded-pairing mechanism and credential, the D229 equal-certificate homecoming, and the D230 admission rule all stand. Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r113 was never implemented.Design checkpoint (2026-11-02, r114 review outcome + r115 revision)
Design-review outcome (2026-11-02): the independent design review of r114 returned REQUEST_CHANGES with one finding, verified valid against the reviewed revision (r114 at
c396dcd7f8, doc content MD56b8876d1be0a0739c2193e1cc99a5c22). The review confirmed D231 corrects the intermediate-key fold oracle, and found: (P1) the active walk specification permitted a premature lineage claim — §5.2's CLAIM accepted a live row born atTwhen that row has no recorded departure (design lines 408-418) while the recorded same-transaction continuation was reached only "otherwise" (lines 466-477), so one transactionUPDATE A 2->3; UPDATE A 3->4; INSERT unrelated B at 3— D228 recordingL1.succ_link_id = L2, B sharing the commit instant with no successor — terminated the specified claim at B before L1's pairing was consulted, allowingUPDATE 2->3to cascade children onto the unrelated row while the destination count guard passed, contradicting I1 and section 10's required final-key cascade. Verified at the cited loci (unchanged shipped code): the shipped parser explicitly prioritizes the recorded continuation (pkg/frontend/data_branch_pk_move_link.go:3183-3237) before the bare timestamp claim (:3239-3301), and the shipped counterexample UTs prove the intruder never ends the chain (pkg/frontend/data_branch_pk_move_link_test.go:603-628,:649-670).Design revision r115 (
a002694fc4, this branch; D228's continuation-order clause amended before implementation, new decision D232 indocs/design/20261016-data-branch-pk-move-update-provenance.md; doc content MD5edb6a8ddba8072c3b2d7e044fa5e97b9): a non-NULL recorded continuation is validated and followed BEFORE any timestamp claim, and missing or contradictory pairing evidence aborts without falling through to a claim — mirroring the shipped parser's order. (a) Order rule, every hop: the walk FIRST settles the incoming link's recorded continuation channel — a NON-NULLsucc_link_idis point-probed and verified per D228(c) (presence; scope equality bytxn_id/write_ts;old_pkequal to the runningnew_pk; strictly greaterstmt_seq) and followed; missing or contradictory pairing evidence (an absent fetch, or a scope, key or ordinal mismatch) fails closed loudly WITHOUT falling through to a timestamp claim; a NULL pairing is TERMINAL (computed unconditionally, so NULL never means unknown) subject to the standing loud cross-check (a retained same-transaction departure of the landed key at a greaterstmt_seqcontradicts NULL and fails closed) — and only then may the walk evaluate the timestamp claim and the stream-driven departure/tail steps at the current key. (b) Soundness: D228(a)'s pairing invariants make a verified pairing always the lineage's own continuation, so following it before the claim never adopts a foreign row; the claim's own qualifier (a candidate with its OWN recorded departure defers to the departure steps) and the cross-transaction departure and same-key tail steps are unchanged in content and relative order; the review's schedule resolves throughL1 -> L2to A's final key 4 and B survives at key 3 as its own plain insert. (c) The D229 homecoming, the D230 admission rule and the D231 fold shape stand: the pairing hop is followed first, the terminal claim at the chain's end accepts the re-birthed row born at the chain instant, and the fold shape is decided by where the chain ends. (d) Validation: section 10's I1 row is extended and gains a new D232 row — the existing workspace and S3 intruder walk UTs (pkg/frontend/data_branch_pk_move_link_test.go:603-628,:649-670) re-pointed to the persistedsucc_link_id/stmt_seqpairing (the pairing followed before the claim; finalPK is A's final key; the intruder survives), a new walk UT driving a non-NULL pairing whose fetched link fails verification and asserting the loud abort WITHOUT a claim of the same-instant live row (no fall-through), and the retained MERGE/PICK twins of the vacate-before-arrival and S3-chain schedules in stamped AND stamp-pending forms — children follow A's final key and B retains its independent insert semantics. (e) The public acceptance projection records the continuation-before-claim order. The D226 windowed gate, the D227 outcome table, the D228 pairing recording and credential with its verification content and loud cross-checks, the D229 homecoming, the D230 admission rule, and the D231 fold shape all stand. Status: submitted for fresh independent design approval; implementation — including that regression battery — waits for that approval. r114 was never implemented.Implementation landed (2026-11-03, approved r115/D232 design)
The independent design review approved r115/D232 (
a002694fc4, doc content MD5edb6a8ddba8072c3b2d7e044fa5e97b9; approval artifactpre-pr-review-1793635842299.json). This push lands the full implementation of the approved repair line on that exact design revision. It resolves the aunjgr straddler finding (threadPRRT_kwDOFEPiGM6ym37d), the same-finding CHANGES_REQUESTED reviewPRR_kwDOFEPiGM8AAAABVdMAig, and the mo-bot-local reviewPRR_kwDOFEPiGM8AAAABVitnng(P2 atdata_branch_pk_move_link.go:1074— the same out-of-window straddler poisoning, reported against the design-only head with "the proposed repair remains unimplemented"; D226 below is that repair, with the MERGE/PICK regression coverage it demanded):commit_tsthrough aclient.CommitEventcompletion callback registered at CN commit (pkg/vm/engine/disttae/pk_move_link_stamp.go); stamping never changes the user-visible COMMIT result, and a failure/crash/lost response leaves the stamp pending (durable NULL) for the recovery path.(table, window)attribution until stream commit membership is established, and a candidate is admitted at a departure instant only when its stored commit instant equals that instant and falls inside its own attributed window segment. A transaction begun before a fork but committed after its lineage window ended can neither bind nor poison a sibling/descendant anchor (the straddler review finding below).succ_link_id, computed unconditionally;stmt_seq) on the link row; the walk follows only the verified recorded pairing.old_pkequal to the running key; strictly greaterstmt_seq) and followed before any timestamp claim; missing or contradictory pairing evidence aborts loudly without fall-through; a NULL pairing is terminal subject to the loud cross-check.Validation surfaced and fixed three implementation bugs inside the new stamp/attribution paths (all within the approved design semantics, none altering any documented decision):
commit_tsfilled), re-arming the completion callback on the stamping transaction's own commit: an unbounded chain of stamping transactions, each appending one more same-key row version for the next one's dedup scan (multi-minute CPU spin in TN dedup; user statements hung behind the serialized internal executor). Fixed by collecting onlycommit_ts-NULL rows — exactly "this transaction's fresh staged links" (D225(b)); regression UT inTestCollectPkMoveLinkStampSet.stmt_seqcollapse on stamped chains — the workspace fill hook stampedstmt_seq = txn.statementIDunconditionally on every link-table insert, including the stamp UPDATE's re-inserted image (statement 1 of the stamping transaction), collapsing a chain's persisted ordinals (1,2) to (1,1) so the D232 walk's strictly-greater ordinal verification aborted every stamped chain merge. Fixed to populate-missing (the writer stages a zero placeholder; a carried ordinal survives); regression UT inTestFillPkMoveLinkNewRowIDsLocked; end-to-end proof: a stamped two-statement chain now persists ordinals (1,2) and merges as a native UPDATE with the child cascading to the final key.(key, scope)inference — the backward arrival-attribution walk bound each hop's predecessor by key-plus-transaction-scope inference, which cannot distinguish two lineages that shared one netted temporary key in one transaction: an identity-less (S3-route) landing records no replacement identity, so two such landings at one key in one scope read as ambiguous and poisoned a valid arrival (caught by the committed era-26 shared-temporary-key BVT case during result regeneration: lineages A2→4→1and C5→4→6in one transaction). Fixed by inverting the recorded D228 pairing:bySuccmaps a successor link's id to the landed links whosesucc_link_idnames it, and the backward walk binds through that credential alone, with scope/ordinal verification failing closed on corrupt evidence and strict ordinals making attribution cycles unrepresentable. Regression UTTestPkMoveArrivalSharedNettedKeyBindsRecordedPairing; the four adversarial arrival oracles (competing exact-identity predecessors, unattributable evidence, contradictory identity, looped continuations) were re-pointed at the persisted pairing and still fail closed. The design's D228 "one mechanism" wording covers both walk directions, so this stays inside the approved semantics.Two committed BVT expectations were also corrected during result regeneration (expectation updates, not code changes):
tcfixture (r59 review F1 — A moves1->2; one later transaction deletes A's landed row at 2 and moves a foreign row through a forty-hop chain onto the same key) asserted the old key-chained walk's conservative abort, because grounding the foreign arrival required walking that chain beyond the attribution hop cap. Under the approved r115 walk the departed-birth-pinned pairing index serves A's own death at key 2 directly (the departed birth equals the running certificate), so the foreign chain is never walked and A's proven deletion applies as an exact DELETE cascade — the same verdict the short-chainstailsibling in the same file already produced on the old code. The fixture's comment and expected result are updated accordingly; the hop-cap fail-closed posture itself remains covered end-to-end by the injected probe-budget BVT case (fj/cn/data_branch_pk_move_link_probe_budget, still aborting identically) and byTestPkMoveLinkProbeBudgetAndBounds.cfd/cfo, pickpfd/pfo) asserted a loud RESTRICT rejection with byte-identical destination rows. Replay on the fix build showed the actual legacy verdict: the same-key delete+insert apply succeeds — the destination accepts the sibling's replacement parent row and the post-apply foreign-key state is satisfied. A control run of the identical schedule with no links anywhere (no straddler) produces the same success, proving this is untouched legacy apply behavior, not a fix side effect. The review substance stands and is what the cases now assert: with the out-of-window straddler excluded (the cases' own catalog probes show its link on the parent table and zero links on the sibling), zero admissible candidates is proven absence — so there is no UPDATE cascade onto the replacement row and no provenance abort, exactly the schedule the pre-fix probe poisoned and aborted. Note the approved design's §10 I2 cell predicted the rejection oracle from a wrong assumption about legacy same-key delete+insert mechanics; the D226 mechanism that cell validates (windowed exclusion → proven absence → legacy replay) is implemented and proven exactly as approved, and a bare source delete with no replacement row keeps its RESTRICT-reject semantics (covered by the pre-existing FK cases in both files).Validation evidence (all green on the pushed head): the focused frontend walk battery (195 tests incl. the D232 intruder/no-fall-through oracles and the era-26 arrival regression), the disttae fixup/stamp suite (48 tests incl. both regression UTs), the multi_update/plan suites,
go vetclean on the touched packages, and the full BVT MERGE/PICK pk-move files regenerated and replayed 100% green on an isolated local service — covering the straddler cross-fork pairs, the stamped AND stamp-pending chain/homecoming/return twins, the vacate-before-arrival schedules, the era-26 shared-temporary-key MERGE/PICK case, and the stamping-failure injection sections.Follow-up (2026-11-03, UT Coverage failure repair,
0f4c3ae65f)Run 41544318517 (attempt 1, head
72bed34633) failedMatrixone UT Coverage execution / UT Coverage on Ubuntu/x86on one test:TestCollectUpdatePkMoveLinkRowsInt32Pkasserted the pre-widening 10-column link attribute list whilenewPkMoveLinkBatchderives the schema from the catalog TableDef, which the implementation commit widened bycommit_ts/succ_link_id/stmt_seq. Cause is inside this PR (a stale expectation the earlier validation round missed), so the fix lands here: the test now expects all 13 attributes and pins the staged placeholders (commit_ts/succ_link_id stage NULL until the commit hook and pairing fixup stamp them; stmt_seq stages 0 until the workspace fill hook stamps the statement ordinal). Verified: the exact CI failure reproduced RED locally on72bed34633, and with the fix the fullpkg/sql/colexec/multi_updatesuite passes (-count=1, exit 0) andgo vetis clean on the package. No production code changed.Follow-up (2026-11-03, SCA Test on Linux/arm64 failure repair,
20b7003394)Run 41549388513 (attempt 1, head
0f4c3ae65f) failedMatrixone CI execution / SCA Test on Linux/arm64in its Static Code Analysis step with four findings on this PR's new code: gofmt comment misalignment inpkg/frontend/data_branch_pk_move_link_test.go:1746andpkg/vm/engine/disttae/pk_move_link_stamp_test.go:453, apreallocfinding on thepkMoveWalkTestRowview builder (data_branch_pk_move_link_test.go:7470), and staticcheck SA6001 on the departure lookup inpairPkMoveLinkContinuationsLocked(pkg/vm/engine/disttae/pk_move_link_fixup.go:4217). Cause is inside this PR (style findings on newly added lines), so the fix lands here: gofmt realignment, the view builder now preallocates4+len(extra)capacity and appends the four fixed rows, and the departure lookup indexesdepartures[acct][string(newPK)]directly so the conversion avoids the allocation. No behavior change. Verified locally with the CI-equivalent gate:make static-check-selected STATIC_CHECK_PACKAGES="./pkg/vm/engine/disttae/ ./pkg/frontend/"(molint +golangci-lint run -c .golangci.yml, 0 issues, exit 0),gofmt -lclean, and the focused tests for the touched paths (TestPairPkMoveLinkContinuations,TestCollectPkMoveLinkStampSet,TestSameKeyTailFailsClosedPastTruncatedForeignArrival,TestResolvePkMoveChain;-count=1, both packagesok, exit 0).Review repair (2026-11-03, mo-bot P1+P2: window-scoped stamp recovery and stamp-transaction pairing exclusion)
The mo-bot-local review
PRR_kwDOFEPiGM8AAAABVoTNeA(head20b7003394) found two persistence defects in timestamp recovery and continuation pairing; both verified valid against the reviewed head, and both are conformance repairs to the approved r115 design (D227's outcome table is explicitly scoped to the candidate window's collected stream; D228's pairing derives from the recording transaction's own statement ledger) — no design revision was required.P1 — D227 recovery healed and re-stamped outside the candidate's attributed window (
pkg/frontend/data_branch_pk_move_link.go). The stream-bound heal inresolveLinkCommitLockedand the same-transaction sibling heal insiblingCommitLockedconsumed the side's merged stream UNSCOPED by the healing link's own(table, window)attribution, and queued the D227(e) best-effort re-stamp before the caller's D226 window gate ran; the departure-pairing directed heal had the same restamp-before-exclusion ordering. The review's schedule: a parent move commits at 40 stamp-pending after the child forks; the child moves the inherited row at 50, so the shared row identity dies only inside the child segment. The child-side merge healed the ancestor link to the child's 50 andflushRestampspersisted it; a later apply of the parent lineage then loadedcommit_ts=50, found it unequal to the departure instant 40, and returnedpkMoveProvenNone— the move's UPDATE provenance lost, exposing the apply to destructive DELETE cascades instead of ON UPDATE behavior. Fixed at all three lanes: heals and taint checks now consider only deaths inside the healing link's own attributed window (out-of-window deaths belong to other generations of a shared row identity — they neither heal nor taint, and are never re-stamped), and the departure-pairing lane applies the window gate before any heal or re-stamp. Window-less unit fixtures and fallback (MinTs, MaxTs] bounds keep the prior unscoped behavior.P2 — commit-time continuation pairing consumed re-inserted historical rows (
pkg/vm/engine/disttae/pk_move_link_fixup.go).pairPkMoveLinkContinuationsLockedruns at every commit, including the commit-stamping/recovery UPDATE's own transaction, whose staged re-inserted images carrycommit_tsfilled. Those rows entered the pairing space with their original transaction scope gone, so ordinal pairing could fabricate a cross-transaction successor (a historical terminal gaining another transaction's link), and the one-shotsucc_link_idcolumn rewrite wrote NULL over unpaired rows, erasing a valid recorded successor whose departure lay outside the staged chunk. Fixed: rows with a non-NULLcommit_tsare excluded from both departures and arrivals — the same qualifier the D225 stamp collector already uses to mean "this transaction's own staged links" (a staged batch lacking the column keeps the pre-filter drift posture) — and the persist step now copies an unpaired row's staged succ cell verbatim instead of writing NULL (fresh link rows stage NULL anyway, so recording-transaction behavior is unchanged).Regression tests. Frontend
TestPkMoveRecoveryHealsOnlyInsideAttributedWindowpins the review's exact schedule and oracles: the out-of-window child death neither heals nor re-stamps the ancestor link (the provider's re-stamp queue is asserted directly), the child link still heals from its own in-window death and resolves; the unpolluted NULL stamp lets the later parent apply heal at 40, resolve to the parent move's final key, and queue the correct 40 re-stamp; and the persisted-metadata control shows the poisoned 50 stamp makes the parent walk returnpkMoveProvenNonewhile the correctly stamped 40 control resolves. DisttaeTestPairPkMoveLinkContinuationsgains two subtests: re-inserted historical rows from two original transactions never pair (the historical terminal keeps NULL), and a partial-chain re-insert preserves an existing successor verbatim through the column rewrite triggered by the transaction's own fresh links; the stamp-independence subtest now pins the corrected semantics (the recording transaction pairs its owncommit_ts-NULL chain; the stamping transaction's re-insert leaves bothcommit_tsand succ cells verbatim).Validation. RED→GREEN on both defects: with only the production fixes stashed, the two new disttae subtests fail (fabricated successor; erased credential) and the new frontend test fails (ancestor re-stamped with the child instant), and with the fixes restored all pass. All nine pre-existing pairing controls and both windowed-straddler subtests still pass (
-count=1,mo-cgo-test, exit 0);gofmtclean;make static-check-selected(molint + golangci-lint, the CI SCA-equivalent gate) clean on both touched packages.