Skip to content

test: stabilize ISCP state transition waits - #26535

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26517
Aug 1, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26517

Conversation

@gouhongshen

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

What this PR does / why we need it:

Five ISCP engine tests used testutils.WaitExpect with a fixed four-second poll. WaitExpect silently returns when its deadline expires, so loaded Ubuntu/x86 runners continued to bare assertions before the asynchronous watermark transition completed. The tests also sampled TxnMgr.Now() after commit, which can be newer than the transaction that actually triggered the ISCP work and therefore is not the correct completion boundary.

The reported CI logs prove this ordering: the assertions failed at the four-second deadline, while the corresponding ISCP iteration started or completed afterward. TestGCInMemoryJob, TestIteration, and TestISCPExecutor7 failed in the original job; later occurrences affected TestISCPExecutor1 and TestStaleRead through the same synchronization pattern.

This change:

  • waits for each reported test's observable watermark transition using the exact triggering transaction commit TS;
  • adds a reusable absent-watermark expectation for unregister/GC transitions and shares polling/diagnostic logic with the existing watermark helper;
  • makes executor startup, job mutation, writes, and commits fatal preconditions so setup errors cannot become misleading watermark failures;
  • retains a bounded 10-second hang guard while returning immediately when the state transition completes;
  • reports the expected state and last completed watermark observation on timeout.

No production code or runtime behavior changes. BVT is not applicable because this is Go-internal asynchronous test synchronization with no SQL behavior change.

Validation on macOS/arm64 against main 26ed429b6:

  • CGo-configured go build -mod=readonly ./pkg/vm/engine/test
  • CGo-configured go vet -mod=readonly ./pkg/vm/engine/test
  • exact focused non-race set: pass
  • adaptive exact race stress with a 30-second budget:
    • TestISCPExecutor1: measured 2.15s, -count=13
    • TestISCPExecutor7: measured 1.30s, -count=23
    • TestGCInMemoryJob: measured 1.40s, -count=21
    • TestIteration: measured 1.75s, -count=17
    • TestStaleRead: measured 1.36s, -count=22
    • TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter: measured 0.10s, -count=100
  • full pkg/vm/engine/test package with -race -count=1: pass, 327.909s
  • full pkg/vm/engine/test package with -count=1: pass, 199.819s
  • git diff --check

Residual risk: no known functional risk; the diff is test-only. The 10-second bound is a hang guard rather than a scheduler-based success condition, and timeout diagnostics preserve the last completed observation without waiting for a blocked getter.

@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Jul 31, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Jul 31, 2026
@gouhongshen
gouhongshen marked this pull request as ready for review July 31, 2026 18:49
@gouhongshen
gouhongshen requested a review from XuPeng-SH as a code owner July 31, 2026 18:49
@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.

Deep-reviewed exact head f874715. Confirmed test-only: the sole changed file is change_handle_test.go. The fix addresses both root causes rather than masking them with a longer sleep: WaitExpect previously timed out silently, and TxnMgr.Now sampled after commit could be newer than the transaction that triggered ISCP, creating an invalid completion boundary. Each wait now targets the exact triggering CommitTS, startup/mutation/write/commit failures are fatal preconditions, and unregister/GC waits assert absence with bounded diagnostics. Restart and timeout paths remain closed; no production performance or behavior impact. Local verification: five affected ISCP scenarios under race count=3, blocked-getter timeout under race count=100, full pkg/vm/engine/test under race (193s), scoped go vet, diff check, latest CI green.

@mergify mergify Bot added the queued label Aug 1, 2026
@mergify

mergify Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-01 00:44 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-01 01:02 UTC · at 78d9282a199817425c281b1aa2c3966003d327b0

This pull request spent 18 minutes in the queue, with no time running CI.

Reason

Pull request #26535 has been merged manually at cdacde2

Hint

You were too fast!

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

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit cdacde2 into matrixorigin:main Aug 1, 2026
24 of 25 checks passed
@mergify mergify Bot removed the queued label Aug 1, 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
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#26517

## What this PR does / why we need it:

Five ISCP engine tests used `testutils.WaitExpect` with a fixed
four-second poll. `WaitExpect` silently returns when its deadline
expires, so loaded Ubuntu/x86 runners continued to bare assertions
before the asynchronous watermark transition completed. The tests also
sampled `TxnMgr.Now()` after commit, which can be newer than the
transaction that actually triggered the ISCP work and therefore is not
the correct completion boundary.

The reported CI logs prove this ordering: the assertions failed at the
four-second deadline, while the corresponding ISCP iteration started or
completed afterward. `TestGCInMemoryJob`, `TestIteration`, and
`TestISCPExecutor7` failed in the original job; later occurrences
affected `TestISCPExecutor1` and `TestStaleRead` through the same
synchronization pattern.

This change:

- waits for each reported test's observable watermark transition using
the exact triggering transaction commit TS;
- adds a reusable absent-watermark expectation for unregister/GC
transitions and shares polling/diagnostic logic with the existing
watermark helper;
- makes executor startup, job mutation, writes, and commits fatal
preconditions so setup errors cannot become misleading watermark
failures;
- retains a bounded 10-second hang guard while returning immediately
when the state transition completes;
- reports the expected state and last completed watermark observation on
timeout.

No production code or runtime behavior changes. BVT is not applicable
because this is Go-internal asynchronous test synchronization with no
SQL behavior change.

Validation on macOS/arm64 against main `26ed429b6`:

- CGo-configured `go build -mod=readonly ./pkg/vm/engine/test`
- CGo-configured `go vet -mod=readonly ./pkg/vm/engine/test`
- exact focused non-race set: pass
- adaptive exact race stress with a 30-second budget:
  - `TestISCPExecutor1`: measured 2.15s, `-count=13`
  - `TestISCPExecutor7`: measured 1.30s, `-count=23`
  - `TestGCInMemoryJob`: measured 1.40s, `-count=21`
  - `TestIteration`: measured 1.75s, `-count=17`
  - `TestStaleRead`: measured 1.36s, `-count=22`
- `TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter`: measured
0.10s, `-count=100`
- full `pkg/vm/engine/test` package with `-race -count=1`: pass,
327.909s
- full `pkg/vm/engine/test` package with `-count=1`: pass, 199.819s
- `git diff --check`

Residual risk: no known functional risk; the diff is test-only. The
10-second bound is a hang guard rather than a scheduler-based success
condition, and timeout diagnostics preserve the last completed
observation without waiting for a blocked getter.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#26517

## What this PR does / why we need it:

Five ISCP engine tests used `testutils.WaitExpect` with a fixed
four-second poll. `WaitExpect` silently returns when its deadline
expires, so loaded Ubuntu/x86 runners continued to bare assertions
before the asynchronous watermark transition completed. The tests also
sampled `TxnMgr.Now()` after commit, which can be newer than the
transaction that actually triggered the ISCP work and therefore is not
the correct completion boundary.

The reported CI logs prove this ordering: the assertions failed at the
four-second deadline, while the corresponding ISCP iteration started or
completed afterward. `TestGCInMemoryJob`, `TestIteration`, and
`TestISCPExecutor7` failed in the original job; later occurrences
affected `TestISCPExecutor1` and `TestStaleRead` through the same
synchronization pattern.

This change:

- waits for each reported test's observable watermark transition using
the exact triggering transaction commit TS;
- adds a reusable absent-watermark expectation for unregister/GC
transitions and shares polling/diagnostic logic with the existing
watermark helper;
- makes executor startup, job mutation, writes, and commits fatal
preconditions so setup errors cannot become misleading watermark
failures;
- retains a bounded 10-second hang guard while returning immediately
when the state transition completes;
- reports the expected state and last completed watermark observation on
timeout.

No production code or runtime behavior changes. BVT is not applicable
because this is Go-internal asynchronous test synchronization with no
SQL behavior change.

Validation on macOS/arm64 against main `26ed429b6`:

- CGo-configured `go build -mod=readonly ./pkg/vm/engine/test`
- CGo-configured `go vet -mod=readonly ./pkg/vm/engine/test`
- exact focused non-race set: pass
- adaptive exact race stress with a 30-second budget:
  - `TestISCPExecutor1`: measured 2.15s, `-count=13`
  - `TestISCPExecutor7`: measured 1.30s, `-count=23`
  - `TestGCInMemoryJob`: measured 1.40s, `-count=21`
  - `TestIteration`: measured 1.75s, `-count=17`
  - `TestStaleRead`: measured 1.36s, `-count=22`
- `TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter`: measured
0.10s, `-count=100`
- full `pkg/vm/engine/test` package with `-race -count=1`: pass,
327.909s
- full `pkg/vm/engine/test` package with `-count=1`: pass, 199.819s
- `git diff --check`

Residual risk: no known functional risk; the diff is test-only. The
10-second bound is a hang guard rather than a scheduler-based success
condition, and timeout diagnostics preserve the last completed
observation without waiting for a blocked getter.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#26517

## What this PR does / why we need it:

Five ISCP engine tests used `testutils.WaitExpect` with a fixed
four-second poll. `WaitExpect` silently returns when its deadline
expires, so loaded Ubuntu/x86 runners continued to bare assertions
before the asynchronous watermark transition completed. The tests also
sampled `TxnMgr.Now()` after commit, which can be newer than the
transaction that actually triggered the ISCP work and therefore is not
the correct completion boundary.

The reported CI logs prove this ordering: the assertions failed at the
four-second deadline, while the corresponding ISCP iteration started or
completed afterward. `TestGCInMemoryJob`, `TestIteration`, and
`TestISCPExecutor7` failed in the original job; later occurrences
affected `TestISCPExecutor1` and `TestStaleRead` through the same
synchronization pattern.

This change:

- waits for each reported test's observable watermark transition using
the exact triggering transaction commit TS;
- adds a reusable absent-watermark expectation for unregister/GC
transitions and shares polling/diagnostic logic with the existing
watermark helper;
- makes executor startup, job mutation, writes, and commits fatal
preconditions so setup errors cannot become misleading watermark
failures;
- retains a bounded 10-second hang guard while returning immediately
when the state transition completes;
- reports the expected state and last completed watermark observation on
timeout.

No production code or runtime behavior changes. BVT is not applicable
because this is Go-internal asynchronous test synchronization with no
SQL behavior change.

Validation on macOS/arm64 against main `26ed429b6`:

- CGo-configured `go build -mod=readonly ./pkg/vm/engine/test`
- CGo-configured `go vet -mod=readonly ./pkg/vm/engine/test`
- exact focused non-race set: pass
- adaptive exact race stress with a 30-second budget:
  - `TestISCPExecutor1`: measured 2.15s, `-count=13`
  - `TestISCPExecutor7`: measured 1.30s, `-count=23`
  - `TestGCInMemoryJob`: measured 1.40s, `-count=21`
  - `TestIteration`: measured 1.75s, `-count=17`
  - `TestStaleRead`: measured 1.36s, `-count=22`
- `TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter`: measured
0.10s, `-count=100`
- full `pkg/vm/engine/test` package with `-race -count=1`: pass,
327.909s
- full `pkg/vm/engine/test` package with `-count=1`: pass, 199.819s
- `git diff --check`

Residual risk: no known functional risk; the diff is test-only. The
10-second bound is a hang guard rather than a scheduler-based success
condition, and timeout diagnostics preserve the last completed
observation without waiting for a blocked getter.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
ci — 78d9282a Deployed Aug 1, 2026 by mergify[bot] via Matrixone Utils CI / Coverage #43943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ISCP engine tests intermittently miss asynchronous state transitions in Ubuntu/x86 CI

3 participants