Repository navigation
test: strengthen subscription lifecycle coverage without permanent-error retries - #28607
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.
Reviewed current head 2961ac9 against main base 2b250ab. COMMENT only because this is a self-authored PR.
Conclusion: no concrete blocking findings.
The change preserves and strengthens Test_SubUnsubTable rather than dropping its target to reduce runtime. In particular:
- The missing-table case now requires ErrNoSuchTable and no residual subscription entry; a context deadline or unrelated error cannot satisfy the assertion. Removing the success helper's outer retries is appropriate for this deliberately permanent failure.
- Initial/duplicate subscription and each of three unsubscribe/resubscribe cycles check the real subscription state and all ten committed primary-key values through a relation reader. ElementsMatch checks multiplicity, so duplicate replay is not silently accepted; the reader also accommodates flushed data.
- Unsubscribe completion is observed through the synchronized state snapshot, not request-send success. The production response handler cleans the memory table before deleting the subscription entry. Subsequent subscriptions therefore follow the completed transition.
- The name-scoped injected error is explicitly observed before fault removal and successful recovery. This proves request-failure recovery, not network reconnection (consistent with the PR description). Fault removal is safe to repeat, and the deferred removal precedes fault.Disable.
- Reader/batch/transaction/pool cleanup is registered per assertion and ordered appropriately. The case remains serial with its own fixture; bounded unsubscribe polling and the existing outer context prevent an unbounded test wait. No production retry policy, other test selection, or suite-level lifecycle is changed.
Design gate: this is a bounded test correction/coverage improvement, not a production feature or major lifecycle refactor requiring a separate design gate.
Validation: inspected the full live diff and current PR comments, traced the exact-head subscription/error/unsubscribe paths plus fixture, reader and fault helpers, and ran git diff --check successfully. Counterexamples considered included timeout masquerading as missing-table rejection, send-versus-completion races, duplicate replay, stale subscription entries, fault persistence and assertions after data flush. The PR reports targeted -race -count=3 passing; I did not independently rerun native tests or wait for CI. The removal of the old retry-driven delay supports the local cost reduction, but is not evidence of end-to-end CI critical-path savings. Head was rechecked unchanged immediately before submission.
## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: #28419 Follow-up to #28568 and #28607; no separate issue. ## What this PR does / why we need it: Repeated setup and fixed sleeps add time to the embedded UT lane. Reuse compatible fixtures and wait for actual SQL-task scheduler cleanup: - Share one ordinary tenant between the concurrent branch-deletion and mo_subs update regressions. Keep their assertions and per-case data cleanup. - Create four immutable PICK sources instead of twelve. Keep all 12 shape/policy cases, independent destinations, and add full source-row immutability assertions after each policy. - Run the S3-disabled Arrow gate checks as a subtest in the identically configured rollback/drain fixture, avoiding one cluster startup. Keep rollout restarts and shutdown assertions. - Replace the SQL-task lifecycle test's fixed 12-second sleep with observed HAKeeper reconciliation and completed overdue catch-up executions. Assert the repeating task entered the scheduler cache before deletion. Preserve cross-CN execution/drop and durable residue checks. The scheduler observer is inactive unless installed by a test. Unit tests cover snapshot ownership, deletion before reconciliation, and reconciliation finishing while an overdue execution remains blocked. Cluster admission and test data sizes are unchanged. ### Validation - All affected integration tests passed locally with `-race -count=3 -tags matrixone_test`. - Both new scheduler observer tests passed with `-race -count=3`. - golangci-lint: 0 issues across the five affected packages; molint passed. Rechecked the isolated package after the final scheduler-owner correction. - License checks and `git diff --check` passed. - Independent GPT-6 medium review completed; fixed its finding that overdue stopper-managed executions must also drain, then re-reviewed. CI wall-time savings require a CI run; local timings do not predict runner contention or the job critical path. ### Local timing comparison Same-machine `-race -count=1` on base `269d59addd` and this branch, selected packages run serially (`-p=1`). Baseline PICK and tenant cases encountered admission waits of 0.457s and 57.136s respectively; these waits are subtracted below, so they are not counted as optimization savings. Results are one sample, not a controlled CI benchmark. | Selected cases | Base, excluding admission wait | Updated | | --- | ---: | ---: | | PICK | 24.91s | 23.03s | | Two tenant regressions | 23.56s | 20.81s | | Arrow rollout + S3 gate | 38.23s | 28.21s | | SQL-task lifecycle | 41.06s | 31.30s | Total selected test time: 127.77s → 103.35s (about 24.4s / 19% lower locally). Compilation and package teardown are excluded. The unchanged admission policy still serializes live embedded clusters.
…ror retries (matrixorigin#28607) Test_SubUnsubTable retried a deliberately missing table through a 1,000-attempt success helper, accepted any error including a deadline, and never explicitly unsubscribed. A successful CI run spent 302.28 seconds in this case. Exercise the real subscription lifecycle using the existing fixture: - Check the subscribed state and read back all 10 primary-key values through a real relation reader after initial and duplicate subscriptions, independent of whether the data has flushed. - Send a real unsubscribe and wait for the response to remove subscription state. - Observe a name-scoped injected subscription failure, remove it, and verify a subsequent request succeeds with the expected rows. This checks recovery after an injected request failure, not network reconnection. - Repeat three unsubscribe/resubscribe cycles, checking state and visible rows every time. - Require ErrNoSuchTable for the absent table, no residual subscription, and a still-functional valid subscription, then explicitly unsubscribe. Validation: targeted -race -count=3 passed (4.210 seconds for the package). Based directly on main; independent of matrixorigin#28568. CI wall-time savings depend on whether this test's shard is on the critical path; the 302-second observation is not an end-to-end savings guarantee.
…xorigin#28613) ## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: matrixorigin#28419 Follow-up to matrixorigin#28568 and matrixorigin#28607; no separate issue. ## What this PR does / why we need it: Repeated setup and fixed sleeps add time to the embedded UT lane. Reuse compatible fixtures and wait for actual SQL-task scheduler cleanup: - Share one ordinary tenant between the concurrent branch-deletion and mo_subs update regressions. Keep their assertions and per-case data cleanup. - Create four immutable PICK sources instead of twelve. Keep all 12 shape/policy cases, independent destinations, and add full source-row immutability assertions after each policy. - Run the S3-disabled Arrow gate checks as a subtest in the identically configured rollback/drain fixture, avoiding one cluster startup. Keep rollout restarts and shutdown assertions. - Replace the SQL-task lifecycle test's fixed 12-second sleep with observed HAKeeper reconciliation and completed overdue catch-up executions. Assert the repeating task entered the scheduler cache before deletion. Preserve cross-CN execution/drop and durable residue checks. The scheduler observer is inactive unless installed by a test. Unit tests cover snapshot ownership, deletion before reconciliation, and reconciliation finishing while an overdue execution remains blocked. Cluster admission and test data sizes are unchanged. ### Validation - All affected integration tests passed locally with `-race -count=3 -tags matrixone_test`. - Both new scheduler observer tests passed with `-race -count=3`. - golangci-lint: 0 issues across the five affected packages; molint passed. Rechecked the isolated package after the final scheduler-owner correction. - License checks and `git diff --check` passed. - Independent GPT-6 medium review completed; fixed its finding that overdue stopper-managed executions must also drain, then re-reviewed. CI wall-time savings require a CI run; local timings do not predict runner contention or the job critical path. ### Local timing comparison Same-machine `-race -count=1` on base `269d59addd` and this branch, selected packages run serially (`-p=1`). Baseline PICK and tenant cases encountered admission waits of 0.457s and 57.136s respectively; these waits are subtracted below, so they are not counted as optimization savings. Results are one sample, not a controlled CI benchmark. | Selected cases | Base, excluding admission wait | Updated | | --- | ---: | ---: | | PICK | 24.91s | 23.03s | | Two tenant regressions | 23.56s | 20.81s | | Arrow rollout + S3 gate | 38.23s | 28.21s | | SQL-task lifecycle | 41.06s | 31.30s | Total selected test time: 127.77s → 103.35s (about 24.4s / 19% lower locally). Compilation and package teardown are excluded. The unchanged admission policy still serializes live embedded clusters.
…ror retries (matrixorigin#28607) Test_SubUnsubTable retried a deliberately missing table through a 1,000-attempt success helper, accepted any error including a deadline, and never explicitly unsubscribed. A successful CI run spent 302.28 seconds in this case. Exercise the real subscription lifecycle using the existing fixture: - Check the subscribed state and read back all 10 primary-key values through a real relation reader after initial and duplicate subscriptions, independent of whether the data has flushed. - Send a real unsubscribe and wait for the response to remove subscription state. - Observe a name-scoped injected subscription failure, remove it, and verify a subsequent request succeeds with the expected rows. This checks recovery after an injected request failure, not network reconnection. - Repeat three unsubscribe/resubscribe cycles, checking state and visible rows every time. - Require ErrNoSuchTable for the absent table, no residual subscription, and a still-functional valid subscription, then explicitly unsubscribe. Validation: targeted -race -count=3 passed (4.210 seconds for the package). Based directly on main; independent of matrixorigin#28568. CI wall-time savings depend on whether this test's shard is on the critical path; the 302-second observation is not an end-to-end savings guarantee.
…xorigin#28613) ## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: matrixorigin#28419 Follow-up to matrixorigin#28568 and matrixorigin#28607; no separate issue. ## What this PR does / why we need it: Repeated setup and fixed sleeps add time to the embedded UT lane. Reuse compatible fixtures and wait for actual SQL-task scheduler cleanup: - Share one ordinary tenant between the concurrent branch-deletion and mo_subs update regressions. Keep their assertions and per-case data cleanup. - Create four immutable PICK sources instead of twelve. Keep all 12 shape/policy cases, independent destinations, and add full source-row immutability assertions after each policy. - Run the S3-disabled Arrow gate checks as a subtest in the identically configured rollback/drain fixture, avoiding one cluster startup. Keep rollout restarts and shutdown assertions. - Replace the SQL-task lifecycle test's fixed 12-second sleep with observed HAKeeper reconciliation and completed overdue catch-up executions. Assert the repeating task entered the scheduler cache before deletion. Preserve cross-CN execution/drop and durable residue checks. The scheduler observer is inactive unless installed by a test. Unit tests cover snapshot ownership, deletion before reconciliation, and reconciliation finishing while an overdue execution remains blocked. Cluster admission and test data sizes are unchanged. ### Validation - All affected integration tests passed locally with `-race -count=3 -tags matrixone_test`. - Both new scheduler observer tests passed with `-race -count=3`. - golangci-lint: 0 issues across the five affected packages; molint passed. Rechecked the isolated package after the final scheduler-owner correction. - License checks and `git diff --check` passed. - Independent GPT-6 medium review completed; fixed its finding that overdue stopper-managed executions must also drain, then re-reviewed. CI wall-time savings require a CI run; local timings do not predict runner contention or the job critical path. ### Local timing comparison Same-machine `-race -count=1` on base `269d59addd` and this branch, selected packages run serially (`-p=1`). Baseline PICK and tenant cases encountered admission waits of 0.457s and 57.136s respectively; these waits are subtracted below, so they are not counted as optimization savings. Results are one sample, not a controlled CI benchmark. | Selected cases | Base, excluding admission wait | Updated | | --- | ---: | ---: | | PICK | 24.91s | 23.03s | | Two tenant regressions | 23.56s | 20.81s | | Arrow rollout + S3 gate | 38.23s | 28.21s | | SQL-task lifecycle | 41.06s | 31.30s | Total selected test time: 127.77s → 103.35s (about 24.4s / 19% lower locally). Compilation and package teardown are excluded. The unchanged admission policy still serializes live embedded clusters.
…ror retries (matrixorigin#28607) Test_SubUnsubTable retried a deliberately missing table through a 1,000-attempt success helper, accepted any error including a deadline, and never explicitly unsubscribed. A successful CI run spent 302.28 seconds in this case. Exercise the real subscription lifecycle using the existing fixture: - Check the subscribed state and read back all 10 primary-key values through a real relation reader after initial and duplicate subscriptions, independent of whether the data has flushed. - Send a real unsubscribe and wait for the response to remove subscription state. - Observe a name-scoped injected subscription failure, remove it, and verify a subsequent request succeeds with the expected rows. This checks recovery after an injected request failure, not network reconnection. - Repeat three unsubscribe/resubscribe cycles, checking state and visible rows every time. - Require ErrNoSuchTable for the absent table, no residual subscription, and a still-functional valid subscription, then explicitly unsubscribe. Validation: targeted -race -count=3 passed (4.210 seconds for the package). Based directly on main; independent of matrixorigin#28568. CI wall-time savings depend on whether this test's shard is on the critical path; the 302-second observation is not an end-to-end savings guarantee.
…xorigin#28613) ## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: matrixorigin#28419 Follow-up to matrixorigin#28568 and matrixorigin#28607; no separate issue. ## What this PR does / why we need it: Repeated setup and fixed sleeps add time to the embedded UT lane. Reuse compatible fixtures and wait for actual SQL-task scheduler cleanup: - Share one ordinary tenant between the concurrent branch-deletion and mo_subs update regressions. Keep their assertions and per-case data cleanup. - Create four immutable PICK sources instead of twelve. Keep all 12 shape/policy cases, independent destinations, and add full source-row immutability assertions after each policy. - Run the S3-disabled Arrow gate checks as a subtest in the identically configured rollback/drain fixture, avoiding one cluster startup. Keep rollout restarts and shutdown assertions. - Replace the SQL-task lifecycle test's fixed 12-second sleep with observed HAKeeper reconciliation and completed overdue catch-up executions. Assert the repeating task entered the scheduler cache before deletion. Preserve cross-CN execution/drop and durable residue checks. The scheduler observer is inactive unless installed by a test. Unit tests cover snapshot ownership, deletion before reconciliation, and reconciliation finishing while an overdue execution remains blocked. Cluster admission and test data sizes are unchanged. ### Validation - All affected integration tests passed locally with `-race -count=3 -tags matrixone_test`. - Both new scheduler observer tests passed with `-race -count=3`. - golangci-lint: 0 issues across the five affected packages; molint passed. Rechecked the isolated package after the final scheduler-owner correction. - License checks and `git diff --check` passed. - Independent GPT-6 medium review completed; fixed its finding that overdue stopper-managed executions must also drain, then re-reviewed. CI wall-time savings require a CI run; local timings do not predict runner contention or the job critical path. ### Local timing comparison Same-machine `-race -count=1` on base `269d59addd` and this branch, selected packages run serially (`-p=1`). Baseline PICK and tenant cases encountered admission waits of 0.457s and 57.136s respectively; these waits are subtracted below, so they are not counted as optimization savings. Results are one sample, not a controlled CI benchmark. | Selected cases | Base, excluding admission wait | Updated | | --- | ---: | ---: | | PICK | 24.91s | 23.03s | | Two tenant regressions | 23.56s | 20.81s | | Arrow rollout + S3 gate | 38.23s | 28.21s | | SQL-task lifecycle | 41.06s | 31.30s | Total selected test time: 127.77s → 103.35s (about 24.4s / 19% lower locally). Compilation and package teardown are excluded. The unchanged admission policy still serializes live embedded clusters.
Test_SubUnsubTable retried a deliberately missing table through a 1,000-attempt success helper, accepted any error including a deadline, and never explicitly unsubscribed. A successful CI run spent 302.28 seconds in this case.
Exercise the real subscription lifecycle using the existing fixture:
Validation: targeted -race -count=3 passed (4.210 seconds for the package). Based directly on main; independent of #28568. CI wall-time savings depend on whether this test's shard is on the critical path; the 302-second observation is not an end-to-end savings guarantee.