Repository navigation
test(txn): make commit ordering deterministic - #28714
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed the complete change at c2a88f9 against main b349fea, issue #28709 and the surrounding transaction test/state paths. No concrete blocker found.
The prepare-entry signal prevents GetTxnState(true) from observing the initial Active state (where it legitimately returns immediately). The continuation signal orders step 1 before completion of prepare/step 2; GetTxnState then supplies the actual transaction-completion dependency before step 3 and txn2 commit/step 4. The exact [1,2,3,4] oracle and both real commits remain, rather than accepting the flaky alternative order. The new channels have one close owner each, sequence writes remain mutex protected, and both test workers join before manager shutdown. No production/API/storage behavior or test selection changes.
Q1: stack-owned channels and existing manager/worker cleanup; Q2: prepare-entry -> continuation -> commit-state completion -> WaitGroup forms the intended acyclic successful execution; Q3: two channels and the fixed four-event sequence are bounded. Unexpected failure before reaching prepare still relies on the package test timeout, not a new per-barrier cancellation mechanism; no reachable new cycle was found in this setup. This test establishes ordering, not guaranteed scheduling of a blocked waiter before prepare completes.
Validation: source reasoning and reuse of the author's reported focused normal/race 100 repetitions, owning-package and vet passes. I did not independently rerun native tests or wait for CI. This focused synchronization fix does not require a new feature design.
Merge Queue Status
This pull request spent 26 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 - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28709 ## What this PR does / why we need it: Replace scheduler-dependent sleeps in `TestTxnManager1` with explicit channel barriers. The barriers establish the intended happens-before relationship between entering txn1 prepare, starting the waiter, completing txn1 prepare, and committing txn2, while preserving the exact ordering assertion. Validation: - `TestTxnManager1` selected successfully - focused test passed 100 repetitions - focused race test passed 100 repetitions - owning package tests passed - `go vet` passed for the owning package Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28709 ## What this PR does / why we need it: Replace scheduler-dependent sleeps in `TestTxnManager1` with explicit channel barriers. The barriers establish the intended happens-before relationship between entering txn1 prepare, starting the waiter, completing txn1 prepare, and committing txn2, while preserving the exact ordering assertion. Validation: - `TestTxnManager1` selected successfully - focused test passed 100 repetitions - focused race test passed 100 repetitions - owning package tests passed - `go vet` passed for the owning package Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28709 ## What this PR does / why we need it: Replace scheduler-dependent sleeps in `TestTxnManager1` with explicit channel barriers. The barriers establish the intended happens-before relationship between entering txn1 prepare, starting the waiter, completing txn1 prepare, and committing txn2, while preserving the exact ordering assertion. Validation: - `TestTxnManager1` selected successfully - focused test passed 100 repetitions - focused race test passed 100 repetitions - owning package tests passed - `go vet` passed for the owning package Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28709
What this PR does / why we need it:
Replace scheduler-dependent sleeps in
TestTxnManager1with explicit channel barriers. The barriers establish the intended happens-before relationship between entering txn1 prepare, starting the waiter, completing txn1 prepare, and committing txn2, while preserving the exact ordering assertion.Validation:
TestTxnManager1selected successfullygo vetpassed for the owning package