Repository navigation
test(iceberg): stop waiter polling after context deadline - #28261
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? |
872aca9 to
ffa13b4
Compare
|
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. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 12 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
…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
…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
…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
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28260
What this PR does / why we need it:
Root cause
waitForLifecycleFaultWaitersissues an immediatetrigger_fault_pointquery, 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 expectedcontext.DeadlineExceeded.Changes
ctx.Err()before every lifecycle waiter SQL poll.This is a test-harness-only lifecycle barrier change; it does not change MatrixOne SQL, catalog, or protocol behavior.
Issue-to-test proof
#28260:TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContextcompletes exactly one zero-waiter query, cancels the context from the controlled driver's row-close barrier, assertscontext.Canceled, and verifies the helper issued no second poll. This covers the expired-context path after a completed poll without relying on scheduler timing.TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext, which passes an already-canceled context, assertscontext.Canceled, and verifies that no SQL query was issued.TestLocalE2EWaitForLifecycleFaultWaitersandTestLocalE2EWaitForLifecycleFaultWaitersRejectsInvalidResponsescontinue 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-testwith the repository CGo/native test setup:-list TestLocalE2EWaitForLifecycleFaultWaitersStopsAfterPollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaitersStopsBeforePollingCanceledContext|TestLocalE2EWaitForLifecycleFaultWaiters-count=100, race-count=100, and coverage-count=100./test/icebergpackage, normal, coverage, and race modes (-count=1)go vet -mod=readonly ./test/icebergAll 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 artifact9968464979; it recorded the exact extra-query failure intest/icebergwith 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, andthirdpartiesinputs matched this checkout; the all-package Linux coverage workload remains a CI validation boundary.