Repository navigation
[4.2-dev] fix: restore DATA BRANCH lineage after restore - #32868
mergify[bot] merged 4 commits into
Conversation
Snapshot/PITR restore recreates tables with new physical IDs. Publish current-ID lineage and ordinary ancestor protection, reconstruct compacted ALTER history, and coordinate with sibling reclamation under the existing lineage DAG lock. Add focused frontend, real-cluster, and BVT regressions. Related to matrixorigin#32820.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Queue requested — the merge queue status continues in this comment ↓. |
Address the SCA prealloc findings for metadata and protection reconciliation.
|
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: 46ef2d6a731d5de7ab63d56f0a15160ec77f7288
Assessment: approve
The fix reuses the restore transaction, DAG lock and protection writer. Historical/current reconciliation is justified to preserve ancestry and deleted states; no actionable defects remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed the complete eight-file delta, linked issue and all three discussion entries; source remained unchanged.
-
All 14 focused frontend tests and eight real-cluster regressions passed using the three-CN fixture.
-
Both owning packages passed normal and race suites under -short; new regressions also passed without -short. Adaptive concurrency validation passed with T=23.41s, B=30s, N=1.
-
Baseline controls reproduced missing lineage and Error 20101 for snapshot and PITR restore; the candidate passed those cases.
-
Verified formatting, 173 native inputs, and command/source/exit receipts against retained logs.
Limitations:
-
Full mo-tester, predecessor-binary and forced-GC retention experiments were not independently rerun.
-
Supplied CI reports UT/SCA/BVT success; external workflow commands and author raw artifacts were unavailable.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #32820.
What this PR does / why we need it:
Snapshot and PITR restore recreate DATA BRANCH tables with new physical
rel_idvalues. The restore path preserved table data anddat_type='data-branch'but did not publish activemo_branch_metadatalineage for those new IDs, so the restored branch failedDATA BRANCH DELETEwith Error 20101.Multi-generation restore also has two related lifecycle requirements: ordinary ancestors need their historical branch protection, and a compacted ALTER generation can have no current metadata when its descendant is restored. Restore must coordinate with deletion of the last live sibling so reclamation cannot remove protection required by the restored descendant.
Root cause
Changes
alter:<level>ancestors as deleted history. Missing ordinary ancestors, duplicates, identity mismatches, malformed history, and cycles fail without partial publication.Issue-to-test proof
TestIssue32820SnapshotRestoreRestitchesBranchLineage,TestIssue32820PITRRestoreRestitchesBranchLineage, andTestIssue32820TableSnapshotRestoreRestitchesBranchLineage;branch_restored_lineage.sql/.resultcovers the user-visible SQL flow. The database snapshot/PITR tests fail on the assigned base with missing current-ID lineage and Error 20101, and pass with this change.TestIssue32820SnapshotRestoreRestoresAncestorProtectionandTestIssue32820PITRRestoreRestoresAncestorProtection.TestIssue32820SnapshotRestoreReconstructsAlterAncestorLineageandTestIssue32820PITRRestoreReconstructsAlterAncestorLineage. Both failed before the repair because B1 metadata was absent.TestIssue32820RestoreSerializesSiblingProtectionReclaim, including exact committed lineage/protection and final cleanup. This test failed before restore joined DAG coordination.TestRestitchRestoredBranchLineage*/TestRestoreBranchLineage*frontend unit tests.For multi-generation cases, the semantic DIFF oracle is exactly one
UPDATErow forid=1,v=11; restored C retains its historicalv=10. Tests also verify that deleted ancestors stay deleted, C-old is not reactivated, reclaimed ALTER protection is not recreated, and final deletion cleans restored protection.Validation
Run from the worktree with
GOWORK=off, the repository CGo environment, and the current compiler scratch directory:Final PR-creation results on implementation commit
d9da981988eccc758a69667ab0e4a6d4dfc8c9fb(before Mergify's automatic target-branch merge):gofmtreported no differences;go list,go build, andgo vetexited 0. All fourteen selected frontend unit tests passed (ok github.com/matrixorigin/matrixone/pkg/frontend 3.404s). All eight selected real-cluster regressions passed (ok github.com/matrixorigin/matrixone/pkg/tests/issues 36.253s). Logs and saved exit statuses are retained understate/artifacts/issue-32820/create-pr-*.Residual risk
The complete repository suite, Go race belt, and full mo-tester BVT suite remain for CI. The focused unit and real-cluster regressions cover the changed restore behavior and its red/green proof; this turn does not claim those broader suites ran.
SCA follow-up
Commit
46ef2d6a731d5de7ab63d56f0a15160ec77f7288preallocates the restored-lineage metadata and protection insert buffers, resolving the twopreallocfindings in MatrixOne ALL CI run 44108040094, job 134126747724.The direct
golangci-lint2.6.2 check (golangci-lint run -v --concurrency 1 -c .golangci.yml ./pkg/frontend) and all fourteen focusedTestRestitchRestoredBranchLineage*/TestRestoreBranchLineage*frontend tests passed locally. The combined Make target's separatemolintvet wrapper could not run with the installed newermolintCLI, so the failed golangci-lint stage was invoked directly with the CI-pinned version; fresh CI will verify the complete static-check target.