Repository navigation
test: stabilize ISCP state transition waits - #26535
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.
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.
Merge Queue Status
This pull request spent 18 minutes in the queue, with no time running CI. ReasonPull request #26535 has been merged manually at cdacde2 HintYou were too fast! 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 - [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>
## 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>
## 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>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26517
What this PR does / why we need it:
Five ISCP engine tests used
testutils.WaitExpectwith a fixed four-second poll.WaitExpectsilently returns when its deadline expires, so loaded Ubuntu/x86 runners continued to bare assertions before the asynchronous watermark transition completed. The tests also sampledTxnMgr.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, andTestISCPExecutor7failed in the original job; later occurrences affectedTestISCPExecutor1andTestStaleReadthrough the same synchronization pattern.This change:
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:go build -mod=readonly ./pkg/vm/engine/testgo vet -mod=readonly ./pkg/vm/engine/testTestISCPExecutor1: measured 2.15s,-count=13TestISCPExecutor7: measured 1.30s,-count=23TestGCInMemoryJob: measured 1.40s,-count=21TestIteration: measured 1.75s,-count=17TestStaleRead: measured 1.36s,-count=22TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter: measured 0.10s,-count=100pkg/vm/engine/testpackage with-race -count=1: pass, 327.909spkg/vm/engine/testpackage with-count=1: pass, 199.819sgit diff --checkResidual 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.