Repository navigation
fix(backup): select file indexes by numeric timestamp - #25970
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No findings. The numeric parser matches types.TS physical/logical ordering and the regression tests cover both width-change failures and malformed names. Existing PR reviews/inline threads are empty; linked issue context was assessed. Local package testing was blocked by the missing CGo libmo prerequisite; all PR CI checks succeeded.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approved on bd27d382.
No blocking findings after tracing the filename contract through listing, numeric parsing, types.TS ordering, index selection, CSV loading, and backup consumption. The implementation correctly handles physical/logical decimal-width changes, zero timestamps, overflow, negative physical values, malformed component counts, and invalid names without allowing them to hide a valid index.
Validation:
- full
pkg/backuptest suite passed locally with the deterministic MatrixOne CGo wrapper; - the new selection and malformed-name tests passed 20x after a clean merge with the latest
main; git diff --checkpassed and the latestmainmerges without conflicts;- all required PR CI checks are green.
Merge Queue Status
This pull request spent 3 hours 8 minutes 40 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #26006 ## What this PR does / why we need it: The latest subscribed-table read path captured an immutable `PartitionState` before it checked the table's pending logtail marker. If the logtail consumer published a newer state and cleared that marker between those two operations, the reader saw `pending=false` and admitted its previously captured stale state. This race caused the `mo_ctl_merge` BVT in job https://github.com/matrixorigin/matrixone/actions/runs/29838470048/job/88667877201 to see fewer than two merge candidates and return `no matching objects`; one second later, `metadata_scan` recaptured the state and saw both unmerged objects. The job belonged to #25970, but that PR changes only backup file-index ordering and does not touch the affected disttae/logtail path. Capture the pending marker before the immutable partition snapshot while holding the subscription generation. With this ordering, a cleared marker proves that the later snapshot includes the applied update; a present marker continues to use the existing applied-watermark wait. The no-pending fast path, historical checkpoint fallback, cancellation, and PK-check reconnect fencing are unchanged. Add a deterministic regression test that retains a pre-apply snapshot, publishes a state covering the read timestamp, clears the pending marker, and verifies that the admission path returns the refreshed state. The test failed on current main with the stale applied watermark before the fix. Tested with: `go test -count=1 ./pkg/vm/engine/disttae` `go test -race -count=1 -run '^(TestCanServeTableSnapshotBlocksPendingUpdate|TestWaitCanServeTableSnapshotWaitsForPendingUpdate|TestWaitCanServeTableSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsResetSubscriptionGeneration|TestPKCheckSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsClosedPushClientAdmission)$' ./pkg/vm/engine/disttae` `go vet ./pkg/vm/engine/disttae` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…5970) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25937 ## What this PR does / why we need it: `LoadGlobalFileIndex` selected the greatest timestamp substring with ordinary string comparison. MatrixOne timestamp components are unpadded decimal values, so both `1-9 > 1-10` and `9-0 > 10-0` are wrong lexicographically. The stale index then makes incremental backup recopy objects that are present only in the newer index. Parse the physical component as `int64` and the logical component as `uint32`, build a `types.TS`, and compare timestamps numerically. Malformed or legacy filenames are ignored rather than panicking or masking a valid index. Tests cover width changes in both components, malformed and overflowing names, and a mixed directory where a lexicographically larger malformed name must not hide a valid index. The confirmed impact is redundant backup I/O/space; this PR does not claim data loss. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/backup` - `go build ./pkg/backup` (repository CGo environment) - `go vet ./pkg/backup` (repository CGo environment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…ixorigin#26009) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26006 ## What this PR does / why we need it: The latest subscribed-table read path captured an immutable `PartitionState` before it checked the table's pending logtail marker. If the logtail consumer published a newer state and cleared that marker between those two operations, the reader saw `pending=false` and admitted its previously captured stale state. This race caused the `mo_ctl_merge` BVT in job https://github.com/matrixorigin/matrixone/actions/runs/29838470048/job/88667877201 to see fewer than two merge candidates and return `no matching objects`; one second later, `metadata_scan` recaptured the state and saw both unmerged objects. The job belonged to matrixorigin#25970, but that PR changes only backup file-index ordering and does not touch the affected disttae/logtail path. Capture the pending marker before the immutable partition snapshot while holding the subscription generation. With this ordering, a cleared marker proves that the later snapshot includes the applied update; a present marker continues to use the existing applied-watermark wait. The no-pending fast path, historical checkpoint fallback, cancellation, and PK-check reconnect fencing are unchanged. Add a deterministic regression test that retains a pre-apply snapshot, publishes a state covering the read timestamp, clears the pending marker, and verifies that the admission path returns the refreshed state. The test failed on current main with the stale applied watermark before the fix. Tested with: `go test -count=1 ./pkg/vm/engine/disttae` `go test -race -count=1 -run '^(TestCanServeTableSnapshotBlocksPendingUpdate|TestWaitCanServeTableSnapshotWaitsForPendingUpdate|TestWaitCanServeTableSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsResetSubscriptionGeneration|TestPKCheckSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsClosedPushClientAdmission)$' ./pkg/vm/engine/disttae` `go vet ./pkg/vm/engine/disttae` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…5970) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25937 ## What this PR does / why we need it: `LoadGlobalFileIndex` selected the greatest timestamp substring with ordinary string comparison. MatrixOne timestamp components are unpadded decimal values, so both `1-9 > 1-10` and `9-0 > 10-0` are wrong lexicographically. The stale index then makes incremental backup recopy objects that are present only in the newer index. Parse the physical component as `int64` and the logical component as `uint32`, build a `types.TS`, and compare timestamps numerically. Malformed or legacy filenames are ignored rather than panicking or masking a valid index. Tests cover width changes in both components, malformed and overflowing names, and a mixed directory where a lexicographically larger malformed name must not hide a valid index. The confirmed impact is redundant backup I/O/space; this PR does not claim data loss. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/backup` - `go build ./pkg/backup` (repository CGo environment) - `go vet ./pkg/backup` (repository CGo environment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…ixorigin#26009) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26006 ## What this PR does / why we need it: The latest subscribed-table read path captured an immutable `PartitionState` before it checked the table's pending logtail marker. If the logtail consumer published a newer state and cleared that marker between those two operations, the reader saw `pending=false` and admitted its previously captured stale state. This race caused the `mo_ctl_merge` BVT in job https://github.com/matrixorigin/matrixone/actions/runs/29838470048/job/88667877201 to see fewer than two merge candidates and return `no matching objects`; one second later, `metadata_scan` recaptured the state and saw both unmerged objects. The job belonged to matrixorigin#25970, but that PR changes only backup file-index ordering and does not touch the affected disttae/logtail path. Capture the pending marker before the immutable partition snapshot while holding the subscription generation. With this ordering, a cleared marker proves that the later snapshot includes the applied update; a present marker continues to use the existing applied-watermark wait. The no-pending fast path, historical checkpoint fallback, cancellation, and PK-check reconnect fencing are unchanged. Add a deterministic regression test that retains a pre-apply snapshot, publishes a state covering the read timestamp, clears the pending marker, and verifies that the admission path returns the refreshed state. The test failed on current main with the stale applied watermark before the fix. Tested with: `go test -count=1 ./pkg/vm/engine/disttae` `go test -race -count=1 -run '^(TestCanServeTableSnapshotBlocksPendingUpdate|TestWaitCanServeTableSnapshotWaitsForPendingUpdate|TestWaitCanServeTableSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsResetSubscriptionGeneration|TestPKCheckSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsClosedPushClientAdmission)$' ./pkg/vm/engine/disttae` `go vet ./pkg/vm/engine/disttae` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…5970) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25937 ## What this PR does / why we need it: `LoadGlobalFileIndex` selected the greatest timestamp substring with ordinary string comparison. MatrixOne timestamp components are unpadded decimal values, so both `1-9 > 1-10` and `9-0 > 10-0` are wrong lexicographically. The stale index then makes incremental backup recopy objects that are present only in the newer index. Parse the physical component as `int64` and the logical component as `uint32`, build a `types.TS`, and compare timestamps numerically. Malformed or legacy filenames are ignored rather than panicking or masking a valid index. Tests cover width changes in both components, malformed and overflowing names, and a mixed directory where a lexicographically larger malformed name must not hide a valid index. The confirmed impact is redundant backup I/O/space; this PR does not claim data loss. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/backup` - `go build ./pkg/backup` (repository CGo environment) - `go vet ./pkg/backup` (repository CGo environment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…ixorigin#26009) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26006 ## What this PR does / why we need it: The latest subscribed-table read path captured an immutable `PartitionState` before it checked the table's pending logtail marker. If the logtail consumer published a newer state and cleared that marker between those two operations, the reader saw `pending=false` and admitted its previously captured stale state. This race caused the `mo_ctl_merge` BVT in job https://github.com/matrixorigin/matrixone/actions/runs/29838470048/job/88667877201 to see fewer than two merge candidates and return `no matching objects`; one second later, `metadata_scan` recaptured the state and saw both unmerged objects. The job belonged to matrixorigin#25970, but that PR changes only backup file-index ordering and does not touch the affected disttae/logtail path. Capture the pending marker before the immutable partition snapshot while holding the subscription generation. With this ordering, a cleared marker proves that the later snapshot includes the applied update; a present marker continues to use the existing applied-watermark wait. The no-pending fast path, historical checkpoint fallback, cancellation, and PK-check reconnect fencing are unchanged. Add a deterministic regression test that retains a pre-apply snapshot, publishes a state covering the read timestamp, clears the pending marker, and verifies that the admission path returns the refreshed state. The test failed on current main with the stale applied watermark before the fix. Tested with: `go test -count=1 ./pkg/vm/engine/disttae` `go test -race -count=1 -run '^(TestCanServeTableSnapshotBlocksPendingUpdate|TestWaitCanServeTableSnapshotWaitsForPendingUpdate|TestWaitCanServeTableSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsResetSubscriptionGeneration|TestPKCheckSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsClosedPushClientAdmission)$' ./pkg/vm/engine/disttae` `go vet ./pkg/vm/engine/disttae` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25937
What this PR does / why we need it:
LoadGlobalFileIndexselected the greatest timestamp substring with ordinarystring comparison. MatrixOne timestamp components are unpadded decimal values,
so both
1-9 > 1-10and9-0 > 10-0are wrong lexicographically. The staleindex then makes incremental backup recopy objects that are present only in the
newer index.
Parse the physical component as
int64and the logical component asuint32,build a
types.TS, and compare timestamps numerically. Malformed or legacyfilenames are ignored rather than panicking or masking a valid index.
Tests cover width changes in both components, malformed and overflowing names,
and a mixed directory where a lexicographically larger malformed name must not
hide a valid index. The confirmed impact is redundant backup I/O/space; this PR
does not claim data loss.
Validation:
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/backupgo build ./pkg/backup(repository CGo environment)go vet ./pkg/backup(repository CGo environment)