Repository navigation
test: cut resource-heavy UT wall time - #27188
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? |
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed head 30c0065bad23db5b68f434784085bdc9173ccf66 against the current origin/main, including the complete diff, affected call paths, test semantics, and the required Ubuntu/x86 UT log.
No P0/P1 findings. One P2 finding is recorded inline. Because this is the first review and there has been no author reply, this review is submitted as COMMENT.
| if (( engine_race_parallel > HEAVY_RACE_PARALLEL )); then | ||
| engine_race_parallel=${HEAVY_RACE_PARALLEL} | ||
| fi | ||
| resource_heavy_parallel=$(( HEAVY_RACE_PARALLEL - engine_race_parallel + 1 )) |
There was a problem hiding this comment.
[P2] Keep the default heavy-stage schedule inside the verified memory budget
With the defaults, engine_race_parallel is 2 and this expression also produces resource_heavy_parallel=2, so the background helper can run two race binaries while the remaining go test -p 2 runs two more. That is four concurrent race-test process slots, one above the configured HEAVY_RACE_PARALLEL=3 budget.
The required Ubuntu/x86 job ran on amd64-mo-shanghai-8c16g and logged memory.peak=17179856896 (exactly 16 GiB), while the PR's stated acceptance criterion is at most 12 GiB. memory.events happened to show no OOM in this run, but report_cgroup_memory_usage only logs the value, so all checks remain green even when the stated headroom criterion is missed. Also, because memory.peak is job-lifetime rather than stage-local, the current log cannot establish that this added overlap stays within the heavy-stage budget.
Please either keep the effective concurrent process count within the configured budget, or add a stage-scoped/enforced memory gate and rerun the required job with evidence below the declared limit.
There was a problem hiding this comment.
合理,已在 e98bea2 采纳。默认调度现在严格共享 HEAVY_RACE_PARALLEL:engine_race_parallel=2,remaining heavy -p1,总数始终为 3;H=1/H=2 使用顺序 wave,H=3..64 已逐值检查满足 engine+remaining=H。新的严格预算本机全阶段复测 PASS:206.10s -> 198.56s,engine helper 125s;合并 JSON analyzer PASS。PR body 也已删除原先 p2/30%/12GiB 的失效说法,并明确 memory.peak 只是 cgroup lifetime 诊断。请 re-review 新 head。
aptend
left a comment
There was a problem hiding this comment.
Deep review completed on exact head 30c0065, including the complete diff, the new sharding/process-group lifecycle, changed timing tests, StarCount coverage consolidation, current review history, and the required Ubuntu/x86 job. Requesting changes for the resource-budget issue already captured in the inline thread.
The default schedule runs two engine race shards concurrently with go test -p 2 for the remaining heavy packages, creating four race-test process slots despite HEAVY_RACE_PARALLEL=3. More importantly, the exact target job 94962091332 reports memory.peak=17179856896 (16 GiB), above the PR body’s explicit 12 GiB acceptance limit. The runner still passes because report_cgroup_memory_usage only logs the lifetime peak; it neither establishes a stage-local peak nor enforces the declared threshold. On an 8-core/16-GiB merge runner, this optimization needs demonstrated headroom rather than a successful run at the cgroup ceiling.
Please keep effective concurrency within the configured budget, or provide a correct stage-scoped/enforced memory measurement and rerun with evidence below the stated limit.
Verification on the exact head: all CI checks are green; bash -n optools/run_ut.sh, active-UT analyzer tests, make thirdparties && make cgo, focused changed lockservice tests under -short -race, both transfer TTL packages, and consolidated StarCount tests all pass. No additional functional blocker was found.
aptend
left a comment
There was a problem hiding this comment.
Re-review completed on exact head 7d28901, including both prior reviews, the author reply, the strict-budget commit, the merge-from-main commit, and the current CI result.
The original resource-budget blocker is fixed: the default is now two engine shards plus remaining heavy packages at -p 1, and the H=1..64 arithmetic stays within HEAVY_RACE_PARALLEL (sequential waves for H=1/2, exactly H concurrent slots for H>=3). The revised cgroup wording is also accurate.
One required change remains: the PR body regressed from issue #26701 to the invalid placeholder issue #. The exact-head CHECK PR VALID job 94977120389 therefore hard-fails with there is no valid issue and all substantive CI jobs are skipped. Please restore the related issue in the current MatrixOne PR template and rerun the full target CI; the PR itself says that Ubuntu/x86 run is the merge authority, and the strict-budget revision has not received that run yet.
Verification: the incremental script diff is limited to the intended budget arithmetic/comments; the subsequent merge changes no PR-owned paths; bash -n, the active-UT analyzer tests, git diff --check, and explicit H=1/2/3/4/8/16/64 schedule calculations pass. No additional code blocker was found.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed exact head df455cfd0c1f5c2edd8d8ab9ce3b9fa9b0453356 against current origin/main 7ad99324cf3dfbfd96e0ff315c8813e0a3cce5df, including the complete six-file diff, the engine test-sharding/process-group and JSON-report paths, lock-keeper/allocator timing paths, transfer-page TTL state transitions, and the consolidated StarCount coverage.
No current P0/P1/P2/P3 findings.
Prior P2 follow-up: my review on 30c0065bad23db5b68f434784085bdc9173ccf66 found that the default schedule used four race-test process slots despite HEAVY_RACE_PARALLEL=3. Author XuPeng-SH replied directly in that thread and adopted the finding in e98bea299a9f8be5b297f8735c0e5cbad0b097f5. I verified that the current code now uses two engine shards plus remaining heavy packages at -p 1 for the default budget, with sequential waves for H=1/H=2. The prior thread is outdated, and the author reply corresponds directly to that P2.
I also checked the PR conversation after the later validation failure: the author restored issue #26701, and CHECK PR VALID now passes. On this exact head, all 25 check runs are completed with no unsuccessful conclusion; the required Ubuntu/x86 UT run passes after discovering and executing 163 engine top-level tests across the two shards, with the combined report analyzer succeeding. SCA and UT coverage also pass.
With no P0/P1 remaining and the prior P2 explicitly answered and fixed, this review is APPROVE.
aptend
left a comment
There was a problem hiding this comment.
Final deep re-review completed on exact head df455cf, including the complete review/reply history, both follow-up merge commits, current six-file diff, and the authoritative target CI run.
Both prior blockers are closed. The strict schedule stays within HEAVY_RACE_PARALLEL (default: two engine shards plus remaining heavy packages at -p 1; H=1/2 use sequential waves), and the PR body again follows the template with issue #26701. The latest merge changes no PR-owned path relative to the reviewed strict-budget revision.
The exact-head Ubuntu/x86 run passes: all 163 engine top-level tests are split 82/81 across the two shards, remaining heavy packages run at -p 1, combined JSON analysis succeeds, FAIL_UT_CASES is empty, and cgroup events report oom 0 / oom_kill 0. CHECK PR VALID, SCA, coverage, proxy BVT, and pessimistic BVT all pass. No remaining correctness, lifecycle, coverage, or resource-budget blocker found.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26701 ## What this PR does / why we need it: The Ubuntu/x86 Unit Testing job still spends most of its wall time in serial, low-CPU test fixture lifecycles. In particular, `pkg/vm/engine/test` takes about three minutes locally under `-short -race` while averaging well below one core. This change attacks that cost without dropping semantic coverage: - builds the `pkg/vm/engine/test` race binary once, discovers every Test/Fuzz/Example dynamically, and distributes the complete set across two fresh concurrent processes; - keeps each shard in the package source directory, writes independent JSON streams, propagates failures, and terminates complete test2json/test-binary process groups on cancellation; - keeps dependency-derived group precedence authoritative, so the package falls back instead of running twice if it ever becomes an embedded-cluster owner; - keeps engine shards and all remaining heavy packages inside the existing `HEAVY_RACE_PARALLEL` total process budget (default: engine two shards + remaining packages `-p 1`); - reports cgroup current/peak/OOM counters for target-runner diagnostics; - replaces production-scale sleeps in lock keeper and transfer-table TTL tests with bounded short-test timing or direct logical-age control; - replaces polling sleeps in the lock waiter regression with cancellation-safe phase barriers; - consolidates four redundant StarCount engine fixtures while preserving empty, committed, uncommitted, large, and tombstone axes. ### Measured strict-budget comparison Same machine, same code, forced `-count=1`: | Schedule | Wall time | Result | |---|---:|---| | current five packages, `-p 3` | 206.10s | PASS | | engine two-shard path + remaining packages `-p 1` | 198.56s | PASS | The complete local stage is 7.54 seconds / 3.7% faster while never exceeding three test-process slots. The engine package runtime itself falls from 179.2s to about 97s (46%); under the strict full-stage contention run its build/list/shards path completed in 125s. Conservative concurrent local RSS was about 6.6 GB. The target Ubuntu/x86 run is authoritative for the net CI wall-time effect. The previous four-process revision is intentionally superseded; it reached the runner's 16-GiB cgroup lifetime peak and did not provide acceptable headroom. ### Validation - all 163 discovered engine top-level tests reached terminal events: 160 pass, 3 existing skips; - all remaining heavy packages passed under strict `-p 1`: backup, fileservice, plan/function, and TAE DB; - combined shard/package JSON passed `go-ut-analysis` with zero failed outputs; - engine full package `-short -race`: PASS; - TAE DB and TAE model full packages `-short -race`: PASS; - lockservice full package `-short -race`: PASS; - lock timing tests passed repeated adaptive race runs; `TestLeakWaiterForErr -race -count=100` passed; - real TERM during engine race build returned 143 with no surviving go-test, test binary, or test2json process; - H=1 through H=64 scheduling arithmetic was reviewed: H>=3 uses exactly H total slots, H=1/H=2 use sequential waves; - `bash -n optools/run_ut.sh`; - `optools/testdata/active_ut_cases_test.bash`; - `make err-check`; - `git diff --check` and gofmt checks. Target CI remains the merge authority: require the full UT job and JSON analysis to pass, with `memory.events` reporting `oom 0` and `oom_kill 0`. `memory.peak` is logged as a conservative cgroup-lifetime diagnostic, not represented as a stage-local measurement.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26701 ## What this PR does / why we need it: The Ubuntu/x86 Unit Testing job still spends most of its wall time in serial, low-CPU test fixture lifecycles. In particular, `pkg/vm/engine/test` takes about three minutes locally under `-short -race` while averaging well below one core. This change attacks that cost without dropping semantic coverage: - builds the `pkg/vm/engine/test` race binary once, discovers every Test/Fuzz/Example dynamically, and distributes the complete set across two fresh concurrent processes; - keeps each shard in the package source directory, writes independent JSON streams, propagates failures, and terminates complete test2json/test-binary process groups on cancellation; - keeps dependency-derived group precedence authoritative, so the package falls back instead of running twice if it ever becomes an embedded-cluster owner; - keeps engine shards and all remaining heavy packages inside the existing `HEAVY_RACE_PARALLEL` total process budget (default: engine two shards + remaining packages `-p 1`); - reports cgroup current/peak/OOM counters for target-runner diagnostics; - replaces production-scale sleeps in lock keeper and transfer-table TTL tests with bounded short-test timing or direct logical-age control; - replaces polling sleeps in the lock waiter regression with cancellation-safe phase barriers; - consolidates four redundant StarCount engine fixtures while preserving empty, committed, uncommitted, large, and tombstone axes. ### Measured strict-budget comparison Same machine, same code, forced `-count=1`: | Schedule | Wall time | Result | |---|---:|---| | current five packages, `-p 3` | 206.10s | PASS | | engine two-shard path + remaining packages `-p 1` | 198.56s | PASS | The complete local stage is 7.54 seconds / 3.7% faster while never exceeding three test-process slots. The engine package runtime itself falls from 179.2s to about 97s (46%); under the strict full-stage contention run its build/list/shards path completed in 125s. Conservative concurrent local RSS was about 6.6 GB. The target Ubuntu/x86 run is authoritative for the net CI wall-time effect. The previous four-process revision is intentionally superseded; it reached the runner's 16-GiB cgroup lifetime peak and did not provide acceptable headroom. ### Validation - all 163 discovered engine top-level tests reached terminal events: 160 pass, 3 existing skips; - all remaining heavy packages passed under strict `-p 1`: backup, fileservice, plan/function, and TAE DB; - combined shard/package JSON passed `go-ut-analysis` with zero failed outputs; - engine full package `-short -race`: PASS; - TAE DB and TAE model full packages `-short -race`: PASS; - lockservice full package `-short -race`: PASS; - lock timing tests passed repeated adaptive race runs; `TestLeakWaiterForErr -race -count=100` passed; - real TERM during engine race build returned 143 with no surviving go-test, test binary, or test2json process; - H=1 through H=64 scheduling arithmetic was reviewed: H>=3 uses exactly H total slots, H=1/H=2 use sequential waves; - `bash -n optools/run_ut.sh`; - `optools/testdata/active_ut_cases_test.bash`; - `make err-check`; - `git diff --check` and gofmt checks. Target CI remains the merge authority: require the full UT job and JSON analysis to pass, with `memory.events` reporting `oom 0` and `oom_kill 0`. `memory.peak` is logged as a conservative cgroup-lifetime diagnostic, not represented as a stage-local measurement.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26701 ## What this PR does / why we need it: The Ubuntu/x86 Unit Testing job still spends most of its wall time in serial, low-CPU test fixture lifecycles. In particular, `pkg/vm/engine/test` takes about three minutes locally under `-short -race` while averaging well below one core. This change attacks that cost without dropping semantic coverage: - builds the `pkg/vm/engine/test` race binary once, discovers every Test/Fuzz/Example dynamically, and distributes the complete set across two fresh concurrent processes; - keeps each shard in the package source directory, writes independent JSON streams, propagates failures, and terminates complete test2json/test-binary process groups on cancellation; - keeps dependency-derived group precedence authoritative, so the package falls back instead of running twice if it ever becomes an embedded-cluster owner; - keeps engine shards and all remaining heavy packages inside the existing `HEAVY_RACE_PARALLEL` total process budget (default: engine two shards + remaining packages `-p 1`); - reports cgroup current/peak/OOM counters for target-runner diagnostics; - replaces production-scale sleeps in lock keeper and transfer-table TTL tests with bounded short-test timing or direct logical-age control; - replaces polling sleeps in the lock waiter regression with cancellation-safe phase barriers; - consolidates four redundant StarCount engine fixtures while preserving empty, committed, uncommitted, large, and tombstone axes. ### Measured strict-budget comparison Same machine, same code, forced `-count=1`: | Schedule | Wall time | Result | |---|---:|---| | current five packages, `-p 3` | 206.10s | PASS | | engine two-shard path + remaining packages `-p 1` | 198.56s | PASS | The complete local stage is 7.54 seconds / 3.7% faster while never exceeding three test-process slots. The engine package runtime itself falls from 179.2s to about 97s (46%); under the strict full-stage contention run its build/list/shards path completed in 125s. Conservative concurrent local RSS was about 6.6 GB. The target Ubuntu/x86 run is authoritative for the net CI wall-time effect. The previous four-process revision is intentionally superseded; it reached the runner's 16-GiB cgroup lifetime peak and did not provide acceptable headroom. ### Validation - all 163 discovered engine top-level tests reached terminal events: 160 pass, 3 existing skips; - all remaining heavy packages passed under strict `-p 1`: backup, fileservice, plan/function, and TAE DB; - combined shard/package JSON passed `go-ut-analysis` with zero failed outputs; - engine full package `-short -race`: PASS; - TAE DB and TAE model full packages `-short -race`: PASS; - lockservice full package `-short -race`: PASS; - lock timing tests passed repeated adaptive race runs; `TestLeakWaiterForErr -race -count=100` passed; - real TERM during engine race build returned 143 with no surviving go-test, test binary, or test2json process; - H=1 through H=64 scheduling arithmetic was reviewed: H>=3 uses exactly H total slots, H=1/H=2 use sequential waves; - `bash -n optools/run_ut.sh`; - `optools/testdata/active_ut_cases_test.bash`; - `make err-check`; - `git diff --check` and gofmt checks. Target CI remains the merge authority: require the full UT job and JSON analysis to pass, with `memory.events` reporting `oom 0` and `oom_kill 0`. `memory.peak` is logged as a conservative cgroup-lifetime diagnostic, not represented as a stage-local measurement.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26701
What this PR does / why we need it:
The Ubuntu/x86 Unit Testing job still spends most of its wall time in serial, low-CPU test fixture lifecycles. In particular,
pkg/vm/engine/testtakes about three minutes locally under-short -racewhile averaging well below one core.This change attacks that cost without dropping semantic coverage:
pkg/vm/engine/testrace binary once, discovers every Test/Fuzz/Example dynamically, and distributes the complete set across two fresh concurrent processes;HEAVY_RACE_PARALLELtotal process budget (default: engine two shards + remaining packages-p 1);Measured strict-budget comparison
Same machine, same code, forced
-count=1:-p 3-p 1The complete local stage is 7.54 seconds / 3.7% faster while never exceeding three test-process slots. The engine package runtime itself falls from 179.2s to about 97s (46%); under the strict full-stage contention run its build/list/shards path completed in 125s. Conservative concurrent local RSS was about 6.6 GB.
The target Ubuntu/x86 run is authoritative for the net CI wall-time effect. The previous four-process revision is intentionally superseded; it reached the runner's 16-GiB cgroup lifetime peak and did not provide acceptable headroom.
Validation
-p 1: backup, fileservice, plan/function, and TAE DB;go-ut-analysiswith zero failed outputs;-short -race: PASS;-short -race: PASS;-short -race: PASS;TestLeakWaiterForErr -race -count=100passed;bash -n optools/run_ut.sh;optools/testdata/active_ut_cases_test.bash;make err-check;git diff --checkand gofmt checks.Target CI remains the merge authority: require the full UT job and JSON analysis to pass, with
memory.eventsreportingoom 0andoom_kill 0.memory.peakis logged as a conservative cgroup-lifetime diagnostic, not represented as a stage-local measurement.