Skip to content

fix: use shared admission for scalar ALTER COPY refresh - #31484

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/085c453bf6c2611a8f34d5a768ca24fddf47c168db3a10ca9397feb51315a225
Oct 27, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/085c453bf6c2611a8f34d5a768ca24fddf47c168db3a10ca9397feb51315a225

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

Follow-up to merged #31435. Its source refresh lets the first ALTER succeed after an in-flight LOAD commits, but the extra full preparation holds the global SNAPSHOT exclusive lifecycle gate and delays unrelated lifecycle operations.

Certify pure scalar ADD COLUMN in the planner and revalidate source, target, private ownership, FK/history and the actual nested CREATE before allowing shared admission through refresh and publication. Preserve preparation before source locking, caller-local writes, allocator state and bounded generations. Carry the retained-ownership FastFail policy through component/name admission; fresh/private-only owners still wait. Late protection uses FastFail promotion/domain acquisition; definition races remain terminal. Existing primary keys and auto-increment columns are supported. Complex, indexed, partitioned, FK and protected-history tables retain the previous broad path and its cost. Shared admission still delays exclusive owners; this change does not remove the extra copy or claim a numeric latency/IO improvement.

Validation: deterministic old-code convoy counterexample; real frontend same-/cross-account and prepared progress, LOAD, transaction/rollback/cancellation/failure and late-protection controls; owning compile normal/race and planner normal; focused adaptive race repetitions; scoped vet/lint. Existing ddl/alter_copy_add_index passed normal mo-tester comparison twice on one embedded two-CN instance, 95/95 statements each, with teardown checks. Full Linux/compose CI remains pending. Exact MySQL return-latency parity was not measured.

Leave the issue open for reporter verification after merge.

CI repair validation (7906a005f7f5abc8bec6c79eba5d54e911a6e937): the PROXY BVT and pessimistic BVT exposed deterministic scalar CREATE certification failures. Recognize NOT NULL encoded in Default.NullAbility and normalize only nested expression Type.Table lineage on cloned trees; preserve default values, nullability, bound function IDs, column coordinates and semantic types. Coverage and CI Required failed downstream of these BVT failures.

New checks: both added regression groups fail before their respective fixes; full compile package (mo-cgo-test -v -count=1 -timeout=180s ./pkg/sql/compile) passes. All four Issue31401 integration tests pass, including the strengthened NOT NULL refresh/progress case, retained locks, transaction cleanup and LOAD. All ten failed BVT scripts pass normal comparison on one embedded two-CN instance (2808 executed statements, 10 existing ignored); expression-default and SHOW CREATE scripts also pass twice on the same instance, with expression-case database teardown verified. Scoped go vet and golangci-lint pass for compile/issues; formatting, license headers and delivery artifact checks pass. Prior unchanged functional evidence is reused. Local validation is Darwin/arm64, not Linux Compose/PROXY parity; full CI for this repair is pending. The preceding exact-head run passed Linux UT, UT coverage and SCA, including the earlier license repair.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 7906a005f7f5abc8bec6c79eba5d54e911a6e937

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 7906a005f7f5abc8bec6c79eba5d54e911a6e937

Assessment: approve

Reviewed the complete 14-file delta, design, callers and discussion. Shared admission preserves source protection, bounded refresh and transaction cleanup; no actionable defects remain. The discussion contains no substantive prior findings or rebuttals.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reviewed certificate generation/cloning, CREATE authority, lock ordering, late protection, publication, rollback/cancellation and regression-test oracles.

  • Frozen exact-head evidence records successful build, UT, static analysis, coverage, PROXY BVT and pessimistic multi-CN BVT checks.

  • Local diff and source/discussion integrity checks passed. Receipts and retained logs are correlated in /home/xupeng/.local/state/mo-bot/jobs/90d920e5e3aa93a84e02e306/attempt-1/validation-manifest.json.

  • Saved discussion-assessment.json and review-notes.md in the assigned diagnostic directory.

Limitations:

  • No local Go tests were rerun. Raw CI logs and author-local execution receipts were not supplied; their detailed execution claims were not independently reproduced.

  • The additional full copy, temporary storage costs and contention with exclusive owners remain documented limitations; no numerical performance improvement was verified.

@mergify mergify Bot added the queued label Oct 27, 2026
@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

16 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 27 Oct, 22:04 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 22:20 · d4fb131

Reason

Pull request #31484 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

@XuPeng-SH
XuPeng-SH merged commit 7e0c9d9 into matrixorigin:main Oct 27, 2026
21 of 22 checks passed
@mergify mergify Bot added dequeued and removed queued labels Oct 27, 2026
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 28, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 28, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

Repair the license-eye SCA findings from CI run 40773355581: correct the
Apache URL typo (LICENSE-2.2 -> LICENSE-2.0) in engine_orphan_gc.go and add
the standard Matrix Origin header to pk_move_pin_charge_test.go,
pk_move_rollback_index_test.go, and pk_move_shrink_boundary_test.go;
license-eye -c .licenserc.yml header check on all four files is 4/4 valid.
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 28, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

Repair the license-eye SCA findings from CI run 40773355581: correct the
Apache URL typo (LICENSE-2.2 -> LICENSE-2.0) in engine_orphan_gc.go and add
the standard Matrix Origin header to pk_move_pin_charge_test.go,
pk_move_rollback_index_test.go, and pk_move_shrink_boundary_test.go;
license-eye -c .licenserc.yml header check on all four files is 4/4 valid.

Repair the Makefile err-check SCA finding from CI run 40776611402: the gate
rejects fmt.Errorf/errors.New text in non-test pkg code, and this branch's
new pk-move files carried 25 fmt.Errorf sites and one errors.New sentinel.
Convert them to moerr constructors; the three per-account reap wraps keep
inner-error identity for the fail-atomic ErrorIs assertions through a typed
dataBranchReapAccountError with Unwrap (message text unchanged). Also clear
the fourteen golangci-lint findings the same job reaches once err-check
passes: a govet nilness dead error branch in the logtailreplay change-handle
Next method, three ineffassign writes (two pk-move link walk fixtures, one
tombstone normalization-charge probe), two prealloc slice hints (reap rows,
link table-def columns), an SA6001 non-pointer map-key copy in the link
receiver, an SA9003 empty condition in the same-key replacement emission, and
six unused symbols (pkMoveLinkID, pkMoveLinkTxnIDUnknown, the stage-stub
commitTS field and isClosed method, the boundary fixture armWrites and
writePaths helpers).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 29, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

Repair the license-eye SCA findings from CI run 40773355581: correct the
Apache URL typo (LICENSE-2.2 -> LICENSE-2.0) in engine_orphan_gc.go and add
the standard Matrix Origin header to pk_move_pin_charge_test.go,
pk_move_rollback_index_test.go, and pk_move_shrink_boundary_test.go;
license-eye -c .licenserc.yml header check on all four files is 4/4 valid.

Repair the Makefile err-check SCA finding from CI run 40776611402: the gate
rejects fmt.Errorf/errors.New text in non-test pkg code, and this branch's
new pk-move files carried 25 fmt.Errorf sites and one errors.New sentinel.
Convert them to moerr constructors; the three per-account reap wraps keep
inner-error identity for the fail-atomic ErrorIs assertions through a typed
dataBranchReapAccountError with Unwrap (message text unchanged). Also clear
the fourteen golangci-lint findings the same job reaches once err-check
passes: a govet nilness dead error branch in the logtailreplay change-handle
Next method, three ineffassign writes (two pk-move link walk fixtures, one
tombstone normalization-charge probe), two prealloc slice hints (reap rows,
link table-def columns), an SA6001 non-pointer map-key copy in the link
receiver, an SA9003 empty condition in the same-key replacement emission, and
six unused symbols (pkMoveLinkID, pkMoveLinkTxnIDUnknown, the stage-stub
commitTS field and isClosed method, the boundary fixture armWrites and
writePaths helpers).

Repair the molint checkrecover SCA finding from CI run 40788517465
(SCA Test on Linux/arm64): the analyzer admits recover() only inside its
whitelisted functions, and the pk-move compaction wave collected worker
panics through an explicit recover() in
Transaction.compactDeletionOnObjsLocked (txn.go:3349). Move that collection
onto the ants pool's PanicHandler in a new unexported runCompactWave
helper: finishSlot runs exactly once per submitted slot and appends the
abort BEFORE Done releases the parent wait on every completion path, and
ants invokes the handler synchronously in the aborted worker's goroutine
while it recovers the panic (v2.12.0 worker.go), so 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 without editing the external linter
whitelist. The compaction slot type moves to package scope for the
helper's signature. New txn_compact_wave_test.go pins the mechanism:
worker panics are collected exactly once, mixed success/panic waves
collect only the panics while slot-local errors stay on their slots,
closed-pool submissions fail instead of hanging the boundary, and empty
waves return cleanly; race battery, the r26 shadow-failure boundary
suite, and the full pk-move boundary regression stay green, and the
CI-pinned molint (go1.27.1 build) reports zero diagnostics on ./....
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 29, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

Repair the license-eye SCA findings from CI run 40773355581: correct the
Apache URL typo (LICENSE-2.2 -> LICENSE-2.0) in engine_orphan_gc.go and add
the standard Matrix Origin header to pk_move_pin_charge_test.go,
pk_move_rollback_index_test.go, and pk_move_shrink_boundary_test.go;
license-eye -c .licenserc.yml header check on all four files is 4/4 valid.

Repair the Makefile err-check SCA finding from CI run 40776611402: the gate
rejects fmt.Errorf/errors.New text in non-test pkg code, and this branch's
new pk-move files carried 25 fmt.Errorf sites and one errors.New sentinel.
Convert them to moerr constructors; the three per-account reap wraps keep
inner-error identity for the fail-atomic ErrorIs assertions through a typed
dataBranchReapAccountError with Unwrap (message text unchanged). Also clear
the fourteen golangci-lint findings the same job reaches once err-check
passes: a govet nilness dead error branch in the logtailreplay change-handle
Next method, three ineffassign writes (two pk-move link walk fixtures, one
tombstone normalization-charge probe), two prealloc slice hints (reap rows,
link table-def columns), an SA6001 non-pointer map-key copy in the link
receiver, an SA9003 empty condition in the same-key replacement emission, and
six unused symbols (pkMoveLinkID, pkMoveLinkTxnIDUnknown, the stage-stub
commitTS field and isClosed method, the boundary fixture armWrites and
writePaths helpers).

Repair the molint checkrecover SCA finding from CI run 40788517465
(SCA Test on Linux/arm64): the analyzer admits recover() only inside its
whitelisted functions, and the pk-move compaction wave collected worker
panics through an explicit recover() in
Transaction.compactDeletionOnObjsLocked (txn.go:3349). Move that collection
onto the ants pool's PanicHandler in a new unexported runCompactWave
helper: finishSlot runs exactly once per submitted slot and appends the
abort BEFORE Done releases the parent wait on every completion path, and
ants invokes the handler synchronously in the aborted worker's goroutine
while it recovers the panic (v2.12.0 worker.go), so 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 without editing the external linter
whitelist. The compaction slot type moves to package scope for the
helper's signature. New txn_compact_wave_test.go pins the mechanism:
worker panics are collected exactly once, mixed success/panic waves
collect only the panics while slot-local errors stay on their slots,
closed-pool submissions fail instead of hanging the boundary, and empty
waves return cleanly; race battery, the r26 shadow-failure boundary
suite, and the full pk-move boundary regression stay green, and the
CI-pinned molint (go1.27.1 build) reports zero diagnostics on ./....

Repair the six terminal failures of CI run 40797678570 (attempt 1),
triaged per failed-job terminal log into five PR-caused classes
(design r99): (A) the UT cascade (UT Test / UT Coverage on
Ubuntu/x86) from the on-demand tenant upgrade walk hard-breaking at
the frozen v4_0_7 handle in every case, so a 4.0.7-born tenant never
planned the remaining chain and the bootstrap stall starved
mo_task.sys_cron_task into the nil-deref cascade
(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 v4_0_8 embed fixture expectation
follows); (B) the multi-cn PROXY fulltext 300s watchdog hang from
fencing-retirement witness rounds firing for commits that never
wrote staged state, compounding into lockservice starvation (new
D219 pre-round gate in RunDataBranchFencingRetirementCS: exclusive
ledger-row-key grant first, then locked-view committed-link and
row_kind=0 retention-identity probes; neither present skips the
witness round, watermark fold and certification entirely); (C) the
61->63 mo_catalog table-count diffs in the sp_table, show,
database_statistics, information_schema, create_user_default_role,
restore_cluster_table, cluster_level_snapshot_restore_cluster and
clone_sys_db_table_to_new_db_table .result oracles from the two new
catalog tables; and (D) the TestGCFiles round-two false PASS from
the D121 live-reference guard filtering a re-used fixed
object-name set (round 2 now writes fresh names whose
distinguishing byte lands inside the ObjectName.String() key
window the guard compares). The merge/pick
provenance aborts on the pess compose job are PR-caused but did NOT
reproduce in sustained local replays - both suites run 100% green
(2008/2008 merge, 1721/1721 pick) on a local two-CN
pessimistic-RC cluster under DISK-V2 and MINIO storage shapes; the
leading hypothesis is CI-runner evidence starvation from the class-B
retirement storm, whose gate is the direct remedy, and the post-push
CI run owns the verdict.
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 29, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

Repair the license-eye SCA findings from CI run 40773355581: correct the
Apache URL typo (LICENSE-2.2 -> LICENSE-2.0) in engine_orphan_gc.go and add
the standard Matrix Origin header to pk_move_pin_charge_test.go,
pk_move_rollback_index_test.go, and pk_move_shrink_boundary_test.go;
license-eye -c .licenserc.yml header check on all four files is 4/4 valid.

Repair the Makefile err-check SCA finding from CI run 40776611402: the gate
rejects fmt.Errorf/errors.New text in non-test pkg code, and this branch's
new pk-move files carried 25 fmt.Errorf sites and one errors.New sentinel.
Convert them to moerr constructors; the three per-account reap wraps keep
inner-error identity for the fail-atomic ErrorIs assertions through a typed
dataBranchReapAccountError with Unwrap (message text unchanged). Also clear
the fourteen golangci-lint findings the same job reaches once err-check
passes: a govet nilness dead error branch in the logtailreplay change-handle
Next method, three ineffassign writes (two pk-move link walk fixtures, one
tombstone normalization-charge probe), two prealloc slice hints (reap rows,
link table-def columns), an SA6001 non-pointer map-key copy in the link
receiver, an SA9003 empty condition in the same-key replacement emission, and
six unused symbols (pkMoveLinkID, pkMoveLinkTxnIDUnknown, the stage-stub
commitTS field and isClosed method, the boundary fixture armWrites and
writePaths helpers).

Repair the molint checkrecover SCA finding from CI run 40788517465
(SCA Test on Linux/arm64): the analyzer admits recover() only inside its
whitelisted functions, and the pk-move compaction wave collected worker
panics through an explicit recover() in
Transaction.compactDeletionOnObjsLocked (txn.go:3349). Move that collection
onto the ants pool's PanicHandler in a new unexported runCompactWave
helper: finishSlot runs exactly once per submitted slot and appends the
abort BEFORE Done releases the parent wait on every completion path, and
ants invokes the handler synchronously in the aborted worker's goroutine
while it recovers the panic (v2.12.0 worker.go), so 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 without editing the external linter
whitelist. The compaction slot type moves to package scope for the
helper's signature. New txn_compact_wave_test.go pins the mechanism:
worker panics are collected exactly once, mixed success/panic waves
collect only the panics while slot-local errors stay on their slots,
closed-pool submissions fail instead of hanging the boundary, and empty
waves return cleanly; race battery, the r26 shadow-failure boundary
suite, and the full pk-move boundary regression stay green, and the
CI-pinned molint (go1.27.1 build) reports zero diagnostics on ./....

Repair the six terminal failures of CI run 40797678570 (attempt 1),
triaged per failed-job terminal log into five PR-caused classes
(design r99): (A) the UT cascade (UT Test / UT Coverage on
Ubuntu/x86) from the on-demand tenant upgrade walk hard-breaking at
the frozen v4_0_7 handle in every case, so a 4.0.7-born tenant never
planned the remaining chain and the bootstrap stall starved
mo_task.sys_cron_task into the nil-deref cascade
(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 v4_0_8 embed fixture expectation
follows); (B) the multi-cn PROXY fulltext 300s watchdog hang from
fencing-retirement witness rounds firing for commits that never
wrote staged state, compounding into lockservice starvation (new
D219 pre-round gate in RunDataBranchFencingRetirementCS: exclusive
ledger-row-key grant first, then locked-view committed-link and
row_kind=0 retention-identity probes; neither present skips the
witness round, watermark fold and certification entirely); (C) the
61->63 mo_catalog table-count diffs in the sp_table, show,
database_statistics, information_schema, create_user_default_role,
restore_cluster_table, cluster_level_snapshot_restore_cluster and
clone_sys_db_table_to_new_db_table .result oracles from the two new
catalog tables; and (D) the TestGCFiles round-two false PASS from
the D121 live-reference guard filtering a re-used fixed
object-name set (round 2 now writes fresh names whose
distinguishing byte lands inside the ObjectName.String() key
window the guard compares). The merge/pick
provenance aborts on the pess compose job are PR-caused but did NOT
reproduce in sustained local replays - both suites run 100% green
(2008/2008 merge, 1721/1721 pick) on a local two-CN
pessimistic-RC cluster under DISK-V2 and MINIO storage shapes; the
leading hypothesis is CI-runner evidence starvation from the class-B
retirement storm, whose gate is the direct remedy, and the post-push
CI run owns the verdict.

Close the PROXY-compose SIGSEGV class from run 40842554758: cn-1 died in
maphash.WriteString inside fifocache eviction (enqueueGhost/evict1/
deleteItem) hashing a 42-byte object-name cache key that pointed into freed
off-heap vector memory. The pk-move link spill ferry decodes block infos
with objectio.DecodeBlockInfo — an unsafe reinterpret over the ferried
batch's vector storage — and handed the aliasing blk.MetaLocation() into
LoadOneBlockWithSpecialLayout / ConstructObjStatsByLoadObjMeta; the meta
extent read then retained and re-hashed cache keys derived from memory its
owning batch had already released (49152-row spill groups, ~7.3MB objects,
~2KB meta extents — matching every crash key; fulltext.sql's big-index
build supplied the eviction pressure). Both producers now decode from or
copy into owned locations. Regression UTs assert every FilePath the
fileservice serves during read-back/repair stays disjoint from the
transient batch's vector storage (fails pre-fix, passes post-fix).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 29, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

CI repairs on the same head: DROP ACCOUNT now also retires the per-account
mo_data_branch_update_link and mo_data_branch_link_retention catalogs after
the tenant databases are gone, because every general tenant owns both tables
(new tenants via createSqls, existing tenants via the v4.0.8 upgrade), so
their mo_catalog.mo_tables rows outlived a dropped account and broke the
async-drop leftover accounting in TestDropAccountDuringAsyncIndexInit. The
synthetic pk-move link ctx now declares NotLockMeta: its cross-database
ObjRef otherwise flipped ordinary single-table UPDATEs from the sole
mo_tables name pin they retain on main into LockMeta.doLock's multi-database
branch (extra Shared mo_database pins on the user database and mo_catalog
plus a mo_tables pin on the link row), which let a competing DROP DATABASE
queue on the database pin before ever reaching the retained mo_tables pin
and broke the issue-29400 shared-gate choreography. zz_accesscontrol/
create_account and mo_cloud/mo_cloud BVT expectations list the two new
per-account catalog tables.
New focused regressions: TestUpdatePkMoveLinkCtxSkipsMetaNameLocks (plan),
TestDropAccountRetiresDataBranchCatalogs and
TestDropAccountDataBranchCatalogDropFailureAborts (frontend drop account).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 29, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

CI repairs on the same head: DROP ACCOUNT now also retires the per-account
mo_data_branch_update_link and mo_data_branch_link_retention catalogs after
the tenant databases are gone, because every general tenant owns both tables
(new tenants via createSqls, existing tenants via the v4.0.8 upgrade), so
their mo_catalog.mo_tables rows outlived a dropped account and broke the
async-drop leftover accounting in TestDropAccountDuringAsyncIndexInit. The
synthetic pk-move link ctx now declares NotLockMeta: its cross-database
ObjRef otherwise flipped ordinary single-table UPDATEs from the sole
mo_tables name pin they retain on main into LockMeta.doLock's multi-database
branch (extra Shared mo_database pins on the user database and mo_catalog
plus a mo_tables pin on the link row), which let a competing DROP DATABASE
queue on the database pin before ever reaching the retained mo_tables pin
and broke the issue-29400 shared-gate choreography. zz_accesscontrol/
create_account and mo_cloud/mo_cloud BVT expectations list the two new
per-account catalog tables.
New focused regressions: TestUpdatePkMoveLinkCtxSkipsMetaNameLocks (plan),
TestDropAccountRetiresDataBranchCatalogs and
TestDropAccountDataBranchCatalogDropFailureAborts (frontend drop account).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 30, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

CI repairs on the same head: DROP ACCOUNT now also retires the per-account
mo_data_branch_update_link and mo_data_branch_link_retention catalogs after
the tenant databases are gone, because every general tenant owns both tables
(new tenants via createSqls, existing tenants via the v4.0.8 upgrade), so
their mo_catalog.mo_tables rows outlived a dropped account and broke the
async-drop leftover accounting in TestDropAccountDuringAsyncIndexInit. The
synthetic pk-move link ctx now declares NotLockMeta: its cross-database
ObjRef otherwise flipped ordinary single-table UPDATEs from the sole
mo_tables name pin they retain on main into LockMeta.doLock's multi-database
branch (extra Shared mo_database pins on the user database and mo_catalog
plus a mo_tables pin on the link row), which let a competing DROP DATABASE
queue on the database pin before ever reaching the retained mo_tables pin
and broke the issue-29400 shared-gate choreography. zz_accesscontrol/
create_account and mo_cloud/mo_cloud BVT expectations list the two new
per-account catalog tables.
New focused regressions: TestUpdatePkMoveLinkCtxSkipsMetaNameLocks (plan),
TestDropAccountRetiresDataBranchCatalogs and
TestDropAccountDataBranchCatalogDropFailureAborts (frontend drop account).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 30, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

CI repairs on the same head: DROP ACCOUNT now also retires the per-account
mo_data_branch_update_link and mo_data_branch_link_retention catalogs after
the tenant databases are gone, because every general tenant owns both tables
(new tenants via createSqls, existing tenants via the v4.0.8 upgrade), so
their mo_catalog.mo_tables rows outlived a dropped account and broke the
async-drop leftover accounting in TestDropAccountDuringAsyncIndexInit. The
synthetic pk-move link ctx now declares NotLockMeta: its cross-database
ObjRef otherwise flipped ordinary single-table UPDATEs from the sole
mo_tables name pin they retain on main into LockMeta.doLock's multi-database
branch (extra Shared mo_database pins on the user database and mo_catalog
plus a mo_tables pin on the link row), which let a competing DROP DATABASE
queue on the database pin before ever reaching the retained mo_tables pin
and broke the issue-29400 shared-gate choreography. zz_accesscontrol/
create_account and mo_cloud/mo_cloud BVT expectations list the two new
per-account catalog tables.
New focused regressions: TestUpdatePkMoveLinkCtxSkipsMetaNameLocks (plan),
TestDropAccountRetiresDataBranchCatalogs and
TestDropAccountDataBranchCatalogDropFailureAborts (frontend drop account).
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Oct 31, 2026
…RANCH apply

A branch-side primary-key change was emitted as an independent delete of the
old key plus an insert of the new key, so DATA BRANCH MERGE and DATA BRANCH
PICK replayed it as DELETE/INSERT: the parent-row delete failed with a
foreign-key constraint error whenever the destination declared ON UPDATE
CASCADE/RESTRICT actions, while an ordinary UPDATE on the same parent key
succeeded and cascaded to the child.

Record durable old-to-new update provenance for primary-key moves: the
multi_update producer registers a genesis-locked link into the
mo_data_branch_update_link catalog (keyed first-writer claim, genesis
presence probes bounded by the link_id primary-key prefix range), the change
stream re-associates the delete/insert pair through that link, and MERGE/PICK
apply the move as one native destination UPDATE so declared ON UPDATE actions
run. Provenance retention is owned by a certified funnel with
snapshot/PITR/account coverage rules, fail-atomic owner-removal reaping, and
genesis-lock conflict fencing; ambiguous or unresolved stream evidence aborts
the apply fail-closed instead of emitting unsafe DELETE semantics.

Related to matrixorigin#28026.

Rebased onto main 3cf3888 after matrixorigin#31497 consolidated the unpublished
4.0.8-4.0.17 catalog steps into the frozen 4.0.7 handler: the tenant-upgrade
package relocates to v4_0_8 (Version 4.0.8, MinUpgradeVersion 4.0.7) and
registers after v4_0_7; the frozen-4.0.7 gates in checkUpgrade now key on the
recorded cluster version and the registered frozen handler so a newer final
version keeps the offset-only, offset-mismatch, and legacy-CDC rejections; the
manual-upgrade no-replay coverage splits into behind-cluster rejection (4.0.7
account) and generic final-version no-replay (4.0.8 account);
TestPublishedCatalogUpgradeRoutes gains the 4.0.7 -> 4.0.8 hop including a
ready-4.0.7 fixture; lifecycle_branch_reclaim.go merges matrixorigin#31484's variadic
waitPolicy with the admission-time reclaim identity capture.
Also harden the watermark-fold error classification: awaitLedgerWatermark
maps any error observed at or after the one entry-minted absolute fold
deadline to the named fold-timeout class by wall clock, closing the window
where a stall-delayed inner wait error crossed the deadline before the
derived fold context's deadline flag became visible (observed live during a
host-wide scheduler stall as a 20710 lock-wait surface instead of the
fold-timeout class).

CI repairs on the same head: DROP ACCOUNT now also retires the per-account
mo_data_branch_update_link and mo_data_branch_link_retention catalogs after
the tenant databases are gone, because every general tenant owns both tables
(new tenants via createSqls, existing tenants via the v4.0.8 upgrade), so
their mo_catalog.mo_tables rows outlived a dropped account and broke the
async-drop leftover accounting in TestDropAccountDuringAsyncIndexInit. The
synthetic pk-move link ctx now declares NotLockMeta: its cross-database
ObjRef otherwise flipped ordinary single-table UPDATEs from the sole
mo_tables name pin they retain on main into LockMeta.doLock's multi-database
branch (extra Shared mo_database pins on the user database and mo_catalog
plus a mo_tables pin on the link row), which let a competing DROP DATABASE
queue on the database pin before ever reaching the retained mo_tables pin
and broke the issue-29400 shared-gate choreography. zz_accesscontrol/
create_account and mo_cloud/mo_cloud BVT expectations list the two new
per-account catalog tables.
New focused regressions: TestUpdatePkMoveLinkCtxSkipsMetaNameLocks (plan),
TestDropAccountRetiresDataBranchCatalogs and
TestDropAccountDataBranchCatalogDropFailureAborts (frontend drop account).

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants