Repository navigation
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
The stale-state race is correctly closed and CI is green. One non-blocking fast-path performance regression remains.
P2 - Avoid recapturing the partition twice on every table read (pkg/vm/engine/disttae/logtail_consumer.go:398)
getPartitionState first calls toSubscribeTable, which always captures a snapshot through isSubscribed on success. This new call immediately discards that snapshot and repeats the subscription lookup, timestamp sampling, and GetOrCreateLatestPart, including a globally serialized Engine.Lock. Thus even the common no-pending path now acquires the global engine mutex twice per table open. Carry the pending marker alongside the initial pending-before-snapshot capture, or provide a subscription-only path so the first admission attempt needs only one capture.
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 21 minutes 56 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26009 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.
Failing checks:
HintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head b79905f85338bc1883c05c6a916b578a70f2be8e. No remaining actionable findings.
The previous hot-path blocker is fixed: getPartitionState now reuses the pending-before-snapshot capture returned by toSubscribeTable, so the common subscribed/no-pending path performs one partition capture; recapture occurs only after a real pending wait/retry. The stale-state race remains closed because both the initial attempt and retries validate the subscription generation and read pendingTo before taking the immutable snapshot. Context cancellation, historical checkpoint fallback, and PK-check reconnect fencing are preserved.
Q1-Q3: no new resource ownership, all waits terminate via apply/recapture or caller cancellation, and pending state remains one bounded atomic marker per subscription.
Validation on this exact head passed: focused concurrency regressions under -race -count=20 -shuffle=on, the complete disttae package both normally and under -race, go build, go vet, and git diff --check. Current-head CI has no reported failure at review time.
…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>
…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>
…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 #26006
What this PR does / why we need it:
The latest subscribed-table read path captured an immutable
PartitionStatebefore 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=falseand admitted its previously captured stale state.This race caused the
mo_ctl_mergeBVT in jobhttps://github.com/matrixorigin/matrixone/actions/runs/29838470048/job/88667877201
to see fewer than two merge candidates and return
no matching objects; onesecond later,
metadata_scanrecaptured 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/disttaego test -race -count=1 -run '^(TestCanServeTableSnapshotBlocksPendingUpdate|TestWaitCanServeTableSnapshotWaitsForPendingUpdate|TestWaitCanServeTableSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsResetSubscriptionGeneration|TestPKCheckSnapshotRefreshesAfterPendingApply|TestPKCheckSnapshotRejectsClosedPushClientAdmission)$' ./pkg/vm/engine/disttaego vet ./pkg/vm/engine/disttae