Skip to content

test(iceberg): stop waiter polling after context deadline - #28261

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-28260-085dbf42
Sep 5, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-28260-085dbf42

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Sep 5, 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:

Related to #28260

What this PR does / why we need it:

Root cause

waitForLifecycleFaultWaiters issues an immediate trigger_fault_point query, then waits on a 10 ms ticker or the caller context. Under coverage or a slow scheduler, the query and wait can run long enough for both the ticker and the context deadline to be ready. The select may choose the ticker, and the next loop issued another query without checking the expired context. The deadline regression test has exactly one SQL mock expectation, so that extra poll became the reported unexpected query instead of the expected context.DeadlineExceeded.

Changes

  • Check ctx.Err() before every lifecycle waiter SQL poll.
  • Replace the scheduler-dependent 2 ms deadline regression with a deterministic test driver: the first poll returns a zero waiter count, completing the driver rows cancels the context, and the test verifies that no second poll is issued.
  • Keep an already-canceled-context regression test proving that the guard issues no query when the context is already done.
  • Keep the existing polling interval, successful waiter-count path, database-error path, and response parsing unchanged.

This is a test-harness-only lifecycle barrier change; it does not change MatrixOne SQL, catalog, or protocol behavior.

Issue-to-test proof

  • #28260: TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext completes exactly one zero-waiter query, cancels the context from the controlled driver's row-close barrier, asserts context.Canceled, and verifies the helper issued no second poll. This covers the expired-context path after a completed poll without relying on scheduler timing.
  • The directly related guard path is covered by TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext, which passes an already-canceled context, asserts context.Canceled, and verifies that no SQL query was issued.
  • Existing TestLocalE2EWaitForLifecycleFaultWaiters and TestLocalE2EWaitForLifecycleFaultWaitersRejectsInvalidResponses continue to cover the success, query failure, empty response, and invalid count paths.

BVT is not applicable: the changed function is an internal test E2E barrier and no public SQL or protocol contract changed.

Tests run

Using .agents/skills/mo-dev/scripts/mo-cgo-test with the repository CGo/native test setup:

  • -list TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaiters
  • focused waiter tests, normal -count=100, race -count=100, and coverage -count=100
  • full ./test/iceberg package, normal, coverage, and race modes (-count=1)
  • go vet -mod=readonly ./test/iceberg

All completed successfully. The CGo test wrapper reused a clean, provenance-verified Darwin/arm64 native build with matching tracked native inputs. The pre-fix CI evidence is run 33961743746, diagnostic artifact 9968464979; it recorded the exact extra-query failure in test/iceberg with zero build failures.

Residual risks

The helper still uses its existing 10 ms polling interval and real database fault-point query in the local E2E scenario. The change only suppresses polls after context cancellation/deadline, so it has no production runtime or compatibility impact. The local verification used Darwin/arm64 with a clean native artifact whose tracked Makefile, cgo, and thirdparties inputs matched this checkout; the all-package Linux coverage workload remains a CI validation boundary.

@mergify mergify Bot added the kind/test-ci label Sep 5, 2026
@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Sep 5, 2026
@matrix-meow matrix-meow added size/S Denotes a PR that changes [10,99] lines and removed size/XS Denotes a PR that changes [1, 9] lines labels Sep 5, 2026
@gouhongshen
gouhongshen marked this pull request as ready for review September 5, 2026 14:12
@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 →

@gouhongshen

Copy link
Copy Markdown
Contributor Author

Addressed the valid P1 in ffa13b4.

The 2 ms wall-clock deadline phase is removed. The replacement uses a controlled test driver: the first QueryContext call returns one zero-waiter row, the driver row close (after EOF) closes the first-query barrier and cancels the context, and the test asserts context.Canceled plus exactly one query. The already-canceled zero-query control remains for the pre-poll guard.

Focused normal/race/coverage runs passed 100 times each; the full test/iceberg package passed in normal, coverage, and race modes, and go vet passed. The PR description is updated accordingly.

@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Sep 5, 2026

@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 exact head ffa13b4 against base 7b6603b. The prior P1 is resolved: the 2 ms scheduler race is gone; the controlled driver cancels only after the first zero-waiter result is fully closed, rejects any second query, and the already-canceled control independently proves the pre-poll guard issues no SQL. Lifecycle audit closes cleanly: query rows and DB handles have one cleanup owner, the ticker is stopped, every polling wait terminates through success/error/context, and no state or queue can grow. This remains test-harness-only with negligible per-poll ctx.Err cost and no SQL/protocol compatibility surface. Exact-head shared build, Linux UT, SCA, UT coverage, BVT producers, and coverage merge are green; the author also reports focused normal/race/coverage repetition and full package validation. No blocking findings.

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

mergify Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-05 16:22 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-05 16:22 UTC · at 7764512a416ee21d9a54d7e446f38406f8b039b2 · squash

This pull request spent 12 seconds in the queue, including 2 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

@mergify
mergify Bot merged commit 7764512 into matrixorigin:main Sep 5, 2026
27 of 28 checks passed
@mergify mergify Bot removed the queued label Sep 5, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…in#28261)

### Root cause

`waitForLifecycleFaultWaiters` issues an immediate `trigger_fault_point` query, then waits on a 10 ms ticker or the caller context. Under coverage or a slow scheduler, the query and wait can run long enough for both the ticker and the context deadline to be ready. The select may choose the ticker, and the next loop issued another query without checking the expired context. The deadline regression test has exactly one SQL mock expectation, so that extra poll became the reported unexpected query instead of the expected `context.DeadlineExceeded`.

### Changes

- Check `ctx.Err()` before every lifecycle waiter SQL poll.
- Replace the scheduler-dependent 2 ms deadline regression with a deterministic test driver: the first poll returns a zero waiter count, completing the driver rows cancels the context, and the test verifies that no second poll is issued.
- Keep an already-canceled-context regression test proving that the guard issues no query when the context is already done.
- Keep the existing polling interval, successful waiter-count path, database-error path, and response parsing unchanged.

This is a test-harness-only lifecycle barrier change; it does not change MatrixOne SQL, catalog, or protocol behavior.

### Issue-to-test proof

- `matrixorigin#28260`: `TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext` completes exactly one zero-waiter query, cancels the context from the controlled driver's row-close barrier, asserts `context.Canceled`, and verifies the helper issued no second poll. This covers the expired-context path after a completed poll without relying on scheduler timing.
- The directly related guard path is covered by `TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext`, which passes an already-canceled context, asserts `context.Canceled`, and verifies that no SQL query was issued.
- Existing `TestLocalE2EWaitForLifecycleFaultWaiters` and `TestLocalE2EWaitForLifecycleFaultWaitersRejectsInvalidResponses` continue to cover the success, query failure, empty response, and invalid count paths.

BVT is not applicable: the changed function is an internal test E2E barrier and no public SQL or protocol contract changed.

### Tests run

Using `.agents/skills/mo-dev/scripts/mo-cgo-test` with the repository CGo/native test setup:

- `-list TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaiters`
- focused waiter tests, normal `-count=100`, race `-count=100`, and coverage `-count=100`
- full `./test/iceberg` package, normal, coverage, and race modes (`-count=1`)
- `go vet -mod=readonly ./test/iceberg`

All completed successfully. The CGo test wrapper reused a clean, provenance-verified Darwin/arm64 native build with matching tracked native inputs. The pre-fix CI evidence is run `33961743746`, diagnostic artifact `9968464979`; it recorded the exact extra-query failure in `test/iceberg` with zero build failures.

### Residual risks

The helper still uses its existing 10 ms polling interval and real database fault-point query in the local E2E scenario. The change only suppresses polls after context cancellation/deadline, so it has no production runtime or compatibility impact. The local verification used Darwin/arm64 with a clean native artifact whose tracked `Makefile`, `cgo`, and `thirdparties` inputs matched this checkout; the all-package Linux coverage workload remains a CI validation boundary.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…in#28261)

### Root cause

`waitForLifecycleFaultWaiters` issues an immediate `trigger_fault_point` query, then waits on a 10 ms ticker or the caller context. Under coverage or a slow scheduler, the query and wait can run long enough for both the ticker and the context deadline to be ready. The select may choose the ticker, and the next loop issued another query without checking the expired context. The deadline regression test has exactly one SQL mock expectation, so that extra poll became the reported unexpected query instead of the expected `context.DeadlineExceeded`.

### Changes

- Check `ctx.Err()` before every lifecycle waiter SQL poll.
- Replace the scheduler-dependent 2 ms deadline regression with a deterministic test driver: the first poll returns a zero waiter count, completing the driver rows cancels the context, and the test verifies that no second poll is issued.
- Keep an already-canceled-context regression test proving that the guard issues no query when the context is already done.
- Keep the existing polling interval, successful waiter-count path, database-error path, and response parsing unchanged.

This is a test-harness-only lifecycle barrier change; it does not change MatrixOne SQL, catalog, or protocol behavior.

### Issue-to-test proof

- `matrixorigin#28260`: `TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext` completes exactly one zero-waiter query, cancels the context from the controlled driver's row-close barrier, asserts `context.Canceled`, and verifies the helper issued no second poll. This covers the expired-context path after a completed poll without relying on scheduler timing.
- The directly related guard path is covered by `TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext`, which passes an already-canceled context, asserts `context.Canceled`, and verifies that no SQL query was issued.
- Existing `TestLocalE2EWaitForLifecycleFaultWaiters` and `TestLocalE2EWaitForLifecycleFaultWaitersRejectsInvalidResponses` continue to cover the success, query failure, empty response, and invalid count paths.

BVT is not applicable: the changed function is an internal test E2E barrier and no public SQL or protocol contract changed.

### Tests run

Using `.agents/skills/mo-dev/scripts/mo-cgo-test` with the repository CGo/native test setup:

- `-list TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaiters`
- focused waiter tests, normal `-count=100`, race `-count=100`, and coverage `-count=100`
- full `./test/iceberg` package, normal, coverage, and race modes (`-count=1`)
- `go vet -mod=readonly ./test/iceberg`

All completed successfully. The CGo test wrapper reused a clean, provenance-verified Darwin/arm64 native build with matching tracked native inputs. The pre-fix CI evidence is run `33961743746`, diagnostic artifact `9968464979`; it recorded the exact extra-query failure in `test/iceberg` with zero build failures.

### Residual risks

The helper still uses its existing 10 ms polling interval and real database fault-point query in the local E2E scenario. The change only suppresses polls after context cancellation/deadline, so it has no production runtime or compatibility impact. The local verification used Darwin/arm64 with a clean native artifact whose tracked `Makefile`, `cgo`, and `thirdparties` inputs matched this checkout; the all-package Linux coverage workload remains a CI validation boundary.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…in#28261)

### Root cause

`waitForLifecycleFaultWaiters` issues an immediate `trigger_fault_point` query, then waits on a 10 ms ticker or the caller context. Under coverage or a slow scheduler, the query and wait can run long enough for both the ticker and the context deadline to be ready. The select may choose the ticker, and the next loop issued another query without checking the expired context. The deadline regression test has exactly one SQL mock expectation, so that extra poll became the reported unexpected query instead of the expected `context.DeadlineExceeded`.

### Changes

- Check `ctx.Err()` before every lifecycle waiter SQL poll.
- Replace the scheduler-dependent 2 ms deadline regression with a deterministic test driver: the first poll returns a zero waiter count, completing the driver rows cancels the context, and the test verifies that no second poll is issued.
- Keep an already-canceled-context regression test proving that the guard issues no query when the context is already done.
- Keep the existing polling interval, successful waiter-count path, database-error path, and response parsing unchanged.

This is a test-harness-only lifecycle barrier change; it does not change MatrixOne SQL, catalog, or protocol behavior.

### Issue-to-test proof

- `matrixorigin#28260`: `TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext` completes exactly one zero-waiter query, cancels the context from the controlled driver's row-close barrier, asserts `context.Canceled`, and verifies the helper issued no second poll. This covers the expired-context path after a completed poll without relying on scheduler timing.
- The directly related guard path is covered by `TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext`, which passes an already-canceled context, asserts `context.Canceled`, and verifies that no SQL query was issued.
- Existing `TestLocalE2EWaitForLifecycleFaultWaiters` and `TestLocalE2EWaitForLifecycleFaultWaitersRejectsInvalidResponses` continue to cover the success, query failure, empty response, and invalid count paths.

BVT is not applicable: the changed function is an internal test E2E barrier and no public SQL or protocol contract changed.

### Tests run

Using `.agents/skills/mo-dev/scripts/mo-cgo-test` with the repository CGo/native test setup:

- `-list TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaiters`
- focused waiter tests, normal `-count=100`, race `-count=100`, and coverage `-count=100`
- full `./test/iceberg` package, normal, coverage, and race modes (`-count=1`)
- `go vet -mod=readonly ./test/iceberg`

All completed successfully. The CGo test wrapper reused a clean, provenance-verified Darwin/arm64 native build with matching tracked native inputs. The pre-fix CI evidence is run `33961743746`, diagnostic artifact `9968464979`; it recorded the exact extra-query failure in `test/iceberg` with zero build failures.

### Residual risks

The helper still uses its existing 10 ms polling interval and real database fault-point query in the local E2E scenario. The change only suppresses polls after context cancellation/deadline, so it has no production runtime or compatibility impact. The local verification used Darwin/arm64 with a clean native artifact whose tracked `Makefile`, `cgo`, and `thirdparties` inputs matched this checkout; the all-package Linux coverage workload remains a CI validation boundary.

Approved by: @XuPeng-SH

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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants