Skip to content

test(txn): make commit ordering deterministic - #28714

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
ck89119:issue-28709-main
Sep 11, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
ck89119:issue-28709-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #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

@mergify mergify Bot added the kind/test-ci label Sep 11, 2026
@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Sep 11, 2026
@ck89119
ck89119 marked this pull request as ready for review September 11, 2026 09:25
@ck89119
ck89119 requested a review from XuPeng-SH as a code owner September 11, 2026 09:25
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mergify mergify Bot added the queued label Sep 11, 2026
@mergify

mergify Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-11 11:51 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-09-11 11:52 UTC · at c2a88f9ccee346b4c2ece60338eb08758cebd5c6

This pull request spent 26 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/ci-cancellation.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@mergify mergify Bot added dequeued and removed queued labels Sep 11, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TestTxnManager1 relies on sleeps for commit ordering

3 participants