fix: protect data branch history with internal pitr#24256
fix: protect data branch history with internal pitr#24256gouhongshen wants to merge 3 commits intomatrixorigin:mainfrom
Conversation
Code Review ReportOverview
SummaryThe direction is reasonable: internal PITR is the right mechanism to keep data-branch history recoverable after object merge/GC. The PR is not ready as-is. The main correctness issue is that user-facing PITR filters use Destructive Test VerdictConclusion: insufficient. Covered: reserved-name unit checks and expected SQL string updates for some PITR paths. Missing: an end-to-end UPDATE-vs-INSERT regression after flush/checkpoint/GC, internal PITR create lifecycle assertions, internal PITR cleanup lifecycle assertions, and a direct test that snapshot fallback collects tombstones at Must Fix1. Unescaped
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #23751
What this PR does / why we need it:
DROP TABLE, normalDROP DATABASE, and data branch delete when no active branch metadata still references the protected objectRoot cause:
After the data branch LCA point becomes unrecoverable by historical object state, diff may need to rely on current objects plus commit timestamps to reconstruct the branch-point view. Without pinning the branch point, later object merge/GC can remove the required historical state and cause update rows to be classified as inserts.
Validation:
git diff --checkCGO_CFLAGS="-I$(pwd)/thirdparties/install/include" CGO_LDFLAGS="-L$(pwd)/thirdparties/install/lib" go test ./pkg/frontend -run 'Test.*Pitr|Test.*DataBranch'CGO_CFLAGS="-I$(pwd)/thirdparties/install/include" CGO_LDFLAGS="-L$(pwd)/thirdparties/install/lib" go test ./pkg/sql/plan -run 'TestBuildCreatePitr|TestBuildDropPitr|TestBuildShow'CGO_CFLAGS="-I$(pwd)/thirdparties/install/include" CGO_LDFLAGS="-L$(pwd)/thirdparties/install/lib" go test ./pkg/sql/compile -run 'Test.*Pitr|Test.*CDC|TestCheckPitr|TestDrop'make build