Repository navigation
test: reduce embedded UT execution cost - #28568
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.
Force review conclusion: COMMENT (own PR; APPROVE/REQUEST_CHANGES are not allowed). Exact head: 8bcec10
Conclusion
No confirmed blocker found. The test-cost reductions preserve the main semantic assertions, fixture boundaries, cleanup ownership, and build-mode selection based on source tracing.
Test evidence gaps / unverified risks
- Callback composition lacks a direct regression oracle.
Location: pkg/embed/testing.go:178.
The direct interval test calls adjustBasicClusterService and the lifecycle test bypasses this wrapper through NewCluster. A callback-order regression could therefore pass both tests while overwriting explicit scenario intervals. Please verify default intervals, explicit overrides, callback invocation counts, and added-CN configuration through StartTestCluster with injected startup.
- Plan strings do not independently prove remote runtime work.
Location: pkg/tests/dml/deep_existential_test.go:94.
A plan containing a remote receiver and correct result counts do not prove that nonzero remote work executed. Add a stable runtime signal for the representative case; restoring redundant ANALYZE executions is unnecessary.
- Cancellation/reuse does not prove server-side interrupted execution or same-session reuse.
Location: pkg/tests/dml/deep_existential_test.go:126.
If execution finishes before cancellation, the case may pass without interrupting an active pipeline. sql.DB may also replace a canceled connection; SetMaxOpenConns(1) does not guarantee reuse of the same physical session. Prefer an observable server execution barrier and distinguish pool recovery from same-session reuse.
Validation
CI run 34432700180 matched this exact head. Build, SCA, and coverage were in progress; Ubuntu UT was queued, and compatibility/Darwin jobs were skipped at review time. The reduced existential and pick fixtures were reviewed for expected counts and boundary coverage.
Not executed: fresh local UT/race/vet, live SQL execution, fault injection, repeated/shuffled package execution, teardown postcondition checks, and before/after benchmarks. The reported CI race commands were not independently verified.
Use the short readiness cadence for every test cluster and remove redundant fixture work while preserving distributed execution and chunk-boundary assertions.
8bcec10 to
da45017
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Force review of da45017 against live base/merge-base 2b250ab. COMMENT only (self-authored PR).
Conclusion: no concrete blocker found. This is bounded test-fixture maintenance; no separate feature-design gate is triggered. All four changed files and the previous review were inspected, including the additional manually driven task-scheduler fixture correction that is not listed in the body summary.
Coverage/selection: no test is skipped or removed, and no package/race/shard filtering changes. The existential fixture retains two full 8192-row blocks plus NULL in each table, all five predicates, their expected counts, two candidate executions, the independent OR reference, and cancellation/pool-recovery checks. One representative ANALYZE remains; the other predicates still execute twice and retain cross-CN plan assertions. The pick fixture has 18,193 rows, still crosses into a third block, retains both complete 8192-key ranges (1..8192 and 10000..18191), and keeps three distinct untouched sentinels (8193, 18192, 18193). The other pick rejection/type regressions are unchanged.
Lifecycle: StartTestCluster appends its wrapper after caller options, captures the chosen preStart once, applies the existing short cadence first, and then calls the scenario callback. NewCluster applies options before service construction; the same preStart path is used for newly created services, including expansion. Explicit scenario interval overrides therefore retain precedence. Readiness conditions, timeout budgets, port leases, temporary data-directory ownership and error cleanup are unchanged. The task-scheduler case already explicitly drives bootstrap/checkBootstrap/taskSchedule and asserts unassigned then assigned tasks; disabling its competing HAKeeper ticker removes a second writer without removing the scheduling oracle. Existing helper callers default to workers=true, preserving ticker-dependent expiry/rescheduling cases.
Q1/Q2/Q3: no new resource or asynchronous owner is introduced; existing cluster/store/task-service cleanup remains responsible; only bounded polling cadence changes, not the readiness predicate; fixture rows and scan work decrease. The shorter cadence can add readiness probes during a slow startup, but it neither retries failed assertions nor suppresses execution/test errors.
Non-blocking precision notes retained from the previous review: cancellation after the first client row proves pool recovery, not necessarily interruption of an active server pipeline or reuse of the same physical connection. ANALYZE is restored, but the current string assertions do not explicitly assert nonzero remote runtime counters. A focused callback-order/override test would protect the new wrapper better than the existing direct helper test. These are not newly demonstrated regressions.
Validation: git diff --check passed; exact-head source/consumer and CI snapshot inspected. The body reports focused DML/embed and full arrowload race runs; I did not rerun those native suites or wait for CI, and no measured before/after performance delta is claimed. Please also record the final logservice scheduler regression's selected normal/race evidence and the changed-case timing when available, since the body currently omits that last corrective commit. Current BVT jobs remain in progress; no pending check is treated as passed.
…ror retries (#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 #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.
## 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.
## What Reduce embedded UT setup and fixture work while preserving the assertions that make these regressions valuable. - Apply the short test-only readiness polling cadence to every `StartTestCluster` caller, while allowing scenario-specific callbacks to override it. - Keep two full blocks for the deep existential multi-CN test and retain one `ANALYZE` predicate to verify runtime cross-CN execution; use plan-only inspection for the remaining predicates. - Keep the data-branch pick fixture at three physical blocks, but stop after the two complete key chunks and required untouched sentinels. ## Validation - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDeepExistentialMultiCN$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDataBranchPickRetestRegressions$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/embed -run '^(TestClusterLifecycleAndCNExpansion|TestBasicClusterUsesShortStartupRetryIntervals)$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=900s ./pkg/tests/arrowload` - GPT-6 medium read-only review: passed with no findings after retaining the representative `ANALYZE` check.
…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.
## What Reduce embedded UT setup and fixture work while preserving the assertions that make these regressions valuable. - Apply the short test-only readiness polling cadence to every `StartTestCluster` caller, while allowing scenario-specific callbacks to override it. - Keep two full blocks for the deep existential multi-CN test and retain one `ANALYZE` predicate to verify runtime cross-CN execution; use plan-only inspection for the remaining predicates. - Keep the data-branch pick fixture at three physical blocks, but stop after the two complete key chunks and required untouched sentinels. ## Validation - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDeepExistentialMultiCN$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDataBranchPickRetestRegressions$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/embed -run '^(TestClusterLifecycleAndCNExpansion|TestBasicClusterUsesShortStartupRetryIntervals)$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=900s ./pkg/tests/arrowload` - GPT-6 medium read-only review: passed with no findings after retaining the representative `ANALYZE` check.
…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.
## What Reduce embedded UT setup and fixture work while preserving the assertions that make these regressions valuable. - Apply the short test-only readiness polling cadence to every `StartTestCluster` caller, while allowing scenario-specific callbacks to override it. - Keep two full blocks for the deep existential multi-CN test and retain one `ANALYZE` predicate to verify runtime cross-CN execution; use plan-only inspection for the remaining predicates. - Keep the data-branch pick fixture at three physical blocks, but stop after the two complete key chunks and required untouched sentinels. ## Validation - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDeepExistentialMultiCN$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDataBranchPickRetestRegressions$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/embed -run '^(TestClusterLifecycleAndCNExpansion|TestBasicClusterUsesShortStartupRetryIntervals)$'` - `mo-cgo-test -race -tags matrixone_test -count=1 -timeout=900s ./pkg/tests/arrowload` - GPT-6 medium read-only review: passed with no findings after retaining the representative `ANALYZE` check.
…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.
What
Reduce embedded UT setup and fixture work while preserving the assertions that make these regressions valuable.
StartTestClustercaller, while allowing scenario-specific callbacks to override it.ANALYZEpredicate to verify runtime cross-CN execution; use plan-only inspection for the remaining predicates.Validation
mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDeepExistentialMultiCN$'mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/tests/dml -run '^TestDataBranchPickRetestRegressions$'mo-cgo-test -race -tags matrixone_test -count=1 -timeout=600s ./pkg/embed -run '^(TestClusterLifecycleAndCNExpansion|TestBasicClusterUsesShortStartupRetryIntervals)$'mo-cgo-test -race -tags matrixone_test -count=1 -timeout=900s ./pkg/tests/arrowloadANALYZEcheck.