Repository navigation
test: optimize UT resource usage - #27170
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.
Self-review completed against (head ). No blocking findings.\n\nKey checks:\n- Race package partition is complete: 459 source packages, 459 grouped packages, no duplicates, omissions, or extras. Every group status contributes to .\n- Backup helper owns a finite set of 100 goroutines; every path enters a deferred , the caller waits before restart, and checkpoint observation has a bounded 30s guard. No Q1 leak, Q2 unbounded wait, or Q3 unbounded growth was found.\n- Checksum coverage retains exact coalescing boundaries, EOF cases, aligned/unaligned offsets, randomized 1–3 chunk reads, and deterministic 3 MiB multi-chunk reads while removing repeated large allocations.\n- Disk-cache and S3-prefetch tests still cross eviction/cache-read boundaries and preserve data and hit-count assertions; only redundant iteration/I/O volume is reduced.\n\nFresh local validation after the final commit:\n- \n- \n- \n- owning packages, normal: backup 13.229s; fileservice 37.447s\n- owning packages, race: backup 17.783s; fileservice 41.098s\n\nCI is still running and was not used as a substitute for the local review evidence.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Correction: the previous review lost inline code spans because of shell formatting. The complete review is below.
Self-review completed against main at 26226d2, head 12bf113. No blocking findings.
Key checks:
- Race package partition is complete: 459 source packages, 459 grouped packages, no duplicates, omissions, or extras. Every group status contributes to UT_TEST_STATUS.
- Backup helper owns a finite set of 100 goroutines. Every path enters a deferred WaitGroup.Done; the caller waits before restart; checkpoint observation has a bounded 30-second guard. No Q1 leak, Q2 unbounded wait, or Q3 unbounded growth was found.
- Checksum coverage retains exact coalescing boundaries, EOF cases, aligned and unaligned offsets, randomized one-to-three-chunk reads, and deterministic 3 MiB multi-chunk reads while removing repeated large allocations.
- Disk-cache and S3-prefetch tests still cross eviction and cache-read boundaries and preserve data and hit-count assertions; only redundant iteration and I/O volume is reduced.
Fresh local validation after the final commit:
- bash syntax check for optools/run_ut.sh
- git diff check
- GOWORK=off go list, build, and vet with readonly modules for pkg/backup and pkg/fileservice
- owning packages, normal: backup 13.229s; fileservice 37.447s
- owning packages, race: backup 17.783s; fileservice 41.098s
CI is still running and was not used as a substitute for the local review evidence.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Final self-review completed at e51e720. No blocking findings.\n\nRoot-cause closure:\n- The failed pkg/tests/features binary transitively depends on pkg/embed but was absent from the manual cluster list.\n- The race grouping now derives cluster owners from the complete go test dependency graph. Current discovery returns 10 owners, including pkg/tests/features.\n- Group precedence assigns all 459 packages exactly once: 0 missing, 0 duplicate, 0 extra.\n\nQ1 ownership and cleanup:\n- Temporary fixture modules use t.TempDir.\n- Concurrent allocator and DiskS3 workers are finite and joined; every successful allocation is deallocated.\n- Embedded-cluster package processes are isolated, and process exit remains a backstop for the runner-wide lease.\n- Cron attempts cancel each per-attempt context; production backoff is immutable.\n\nQ2 waits and termination:\n- Discovery is synchronous and preserves go list failures.\n- Worker barriers cannot wait on an unstarted owner.\n- Cluster and resource stages retain the global UT timeout.\n- Polling assertions have bounded deadlines; retry count is fixed at three.\n\nQ3 growth:\n- Package discovery is bounded by the repository package graph.\n- Worker counts, operation counts, read buffers, cache writes, retries, and test matrices are all explicitly bounded.\n- Large diagnostic OOM reproductions remain opt-in.\n\nFresh local evidence:\n- bash syntax, diff checks, optools test/race/vet passed\n- TestTableFeatures race passed twice; full pkg/tests/features race passed\n- full race packages passed: backup 15.4s, fileservice 28.0s, logservice 127.6s, taskservice 26.9s, TAE DB test 105.9s\n\nI did not wait for or use a new CI result as a substitute for code-level validation.
## Summary - discover every race-test package whose complete test binary transitively depends on pkg/embed, then run those packages in a bounded two-process stage while runner-wide admission serializes complete cluster lifecycles - enforce one deterministic group per package with precedence: exclusive, embedded cluster, resource heavy, light - move fileservice, backup, engine integration, and TAE DB packages out of the light 6-way race group without changing the runner - replace time-based allocator and DiskS3 load loops with deterministic, bounded concurrency - remove redundant multi-megabyte IO and non-orthogonal reader-contract cross products - replace external AWS failure timing and fixed scheduler/cron waits with controlled state transitions - strengthen logservice health tests and fix the missing-shard health-check branch they exposed ## Root cause fixed The failed UT run started pkg/tests/features in the light parallel group even though its test binary transitively imports pkg/embed and owns a complete embedded cluster. It competed with other race test binaries for CPU and memory; HAKeeper startup then timed out/reset before TestTableFeatures reached its assertions. The previous directory allowlist could regress whenever a new package acquired an embedded-cluster test dependency. The new grouping is derived from go list -race -test and the complete dependency graph, so pkg/tests/features and future cluster owners are classified automatically. Discovery is fail-closed and covered by transitive, partial-scope, and command-failure tests. ## Why the test optimizations preserve strength The optimized tests retain their semantic axes: concurrent ownership and release, every operation type, exact checksum coalescing boundaries, EOF behavior, reader conformance, retry count, expiration transition, cancellation, restart ordering, and failure cleanup. Large OOM reproductions remain available through their existing opt-in environment gate. ## Measured impact under race - ConcurrentIOAllocatorPressure: max RSS about 663 MB to 123 MB; retired instructions about 8.69B to 0.47B; wall 6.61s to 1.06s - FuzzingDiskS3: max RSS about 502 MB to 346 MB; retired instructions about 17.30B to 3.12B; wall 6.18s to 1.83s - MultiLayerFileWithChecksum: retired instructions about 12.41B to 4.11B - NewAwsSDKv2: external failure wait removed; CI case was about 5.01s and the controlled test body is about 0s - TaskSchedulerCanReScheduleExpiredTasks: CI case was about 5.52s; local controlled transition is about 1.23s - TestCheckHealth: CI case was about 4.06s; local test is about 0.5s and now asserts every negative case - persistent cron retry failure: fixed 10s wait removed while preserving exactly 3 failed attempts - CancelableJob: impossible 5s wait removed; local test is about 0.03s - Embedded-cluster group scheduling: matched local race/-short runs improved from 364.41s at -p 1 to 296.83s at -p 2 (18.5%); max RSS stayed flat at 4.396 GB versus 4.393 GB. A measured -p 3 run was slower and was rejected. ## Validation - package partition: 459 total, 459 assigned exactly once, 0 duplicate, 0 missing, 0 extra - embedded-cluster discovery: 10 owners found; after exclusive-group precedence, 8 run in the cluster stage - bash syntax, diff checks, optools test/race/vet passed - exact failed owner: TestTableFeatures race passed twice; full pkg/tests/features race passed - full race packages passed: backup 15.4s, fileservice 28.0s, logservice 127.6s, taskservice 26.9s, TAE DB test 105.9s - adaptive focused race stress passed for the modified fileservice and taskservice cases No runner change and no test coverage reduction.
## Summary - discover every race-test package whose complete test binary transitively depends on pkg/embed, then run those packages in a bounded two-process stage while runner-wide admission serializes complete cluster lifecycles - enforce one deterministic group per package with precedence: exclusive, embedded cluster, resource heavy, light - move fileservice, backup, engine integration, and TAE DB packages out of the light 6-way race group without changing the runner - replace time-based allocator and DiskS3 load loops with deterministic, bounded concurrency - remove redundant multi-megabyte IO and non-orthogonal reader-contract cross products - replace external AWS failure timing and fixed scheduler/cron waits with controlled state transitions - strengthen logservice health tests and fix the missing-shard health-check branch they exposed ## Root cause fixed The failed UT run started pkg/tests/features in the light parallel group even though its test binary transitively imports pkg/embed and owns a complete embedded cluster. It competed with other race test binaries for CPU and memory; HAKeeper startup then timed out/reset before TestTableFeatures reached its assertions. The previous directory allowlist could regress whenever a new package acquired an embedded-cluster test dependency. The new grouping is derived from go list -race -test and the complete dependency graph, so pkg/tests/features and future cluster owners are classified automatically. Discovery is fail-closed and covered by transitive, partial-scope, and command-failure tests. ## Why the test optimizations preserve strength The optimized tests retain their semantic axes: concurrent ownership and release, every operation type, exact checksum coalescing boundaries, EOF behavior, reader conformance, retry count, expiration transition, cancellation, restart ordering, and failure cleanup. Large OOM reproductions remain available through their existing opt-in environment gate. ## Measured impact under race - ConcurrentIOAllocatorPressure: max RSS about 663 MB to 123 MB; retired instructions about 8.69B to 0.47B; wall 6.61s to 1.06s - FuzzingDiskS3: max RSS about 502 MB to 346 MB; retired instructions about 17.30B to 3.12B; wall 6.18s to 1.83s - MultiLayerFileWithChecksum: retired instructions about 12.41B to 4.11B - NewAwsSDKv2: external failure wait removed; CI case was about 5.01s and the controlled test body is about 0s - TaskSchedulerCanReScheduleExpiredTasks: CI case was about 5.52s; local controlled transition is about 1.23s - TestCheckHealth: CI case was about 4.06s; local test is about 0.5s and now asserts every negative case - persistent cron retry failure: fixed 10s wait removed while preserving exactly 3 failed attempts - CancelableJob: impossible 5s wait removed; local test is about 0.03s - Embedded-cluster group scheduling: matched local race/-short runs improved from 364.41s at -p 1 to 296.83s at -p 2 (18.5%); max RSS stayed flat at 4.396 GB versus 4.393 GB. A measured -p 3 run was slower and was rejected. ## Validation - package partition: 459 total, 459 assigned exactly once, 0 duplicate, 0 missing, 0 extra - embedded-cluster discovery: 10 owners found; after exclusive-group precedence, 8 run in the cluster stage - bash syntax, diff checks, optools test/race/vet passed - exact failed owner: TestTableFeatures race passed twice; full pkg/tests/features race passed - full race packages passed: backup 15.4s, fileservice 28.0s, logservice 127.6s, taskservice 26.9s, TAE DB test 105.9s - adaptive focused race stress passed for the modified fileservice and taskservice cases No runner change and no test coverage reduction.
## Summary - discover every race-test package whose complete test binary transitively depends on pkg/embed, then run those packages in a bounded two-process stage while runner-wide admission serializes complete cluster lifecycles - enforce one deterministic group per package with precedence: exclusive, embedded cluster, resource heavy, light - move fileservice, backup, engine integration, and TAE DB packages out of the light 6-way race group without changing the runner - replace time-based allocator and DiskS3 load loops with deterministic, bounded concurrency - remove redundant multi-megabyte IO and non-orthogonal reader-contract cross products - replace external AWS failure timing and fixed scheduler/cron waits with controlled state transitions - strengthen logservice health tests and fix the missing-shard health-check branch they exposed ## Root cause fixed The failed UT run started pkg/tests/features in the light parallel group even though its test binary transitively imports pkg/embed and owns a complete embedded cluster. It competed with other race test binaries for CPU and memory; HAKeeper startup then timed out/reset before TestTableFeatures reached its assertions. The previous directory allowlist could regress whenever a new package acquired an embedded-cluster test dependency. The new grouping is derived from go list -race -test and the complete dependency graph, so pkg/tests/features and future cluster owners are classified automatically. Discovery is fail-closed and covered by transitive, partial-scope, and command-failure tests. ## Why the test optimizations preserve strength The optimized tests retain their semantic axes: concurrent ownership and release, every operation type, exact checksum coalescing boundaries, EOF behavior, reader conformance, retry count, expiration transition, cancellation, restart ordering, and failure cleanup. Large OOM reproductions remain available through their existing opt-in environment gate. ## Measured impact under race - ConcurrentIOAllocatorPressure: max RSS about 663 MB to 123 MB; retired instructions about 8.69B to 0.47B; wall 6.61s to 1.06s - FuzzingDiskS3: max RSS about 502 MB to 346 MB; retired instructions about 17.30B to 3.12B; wall 6.18s to 1.83s - MultiLayerFileWithChecksum: retired instructions about 12.41B to 4.11B - NewAwsSDKv2: external failure wait removed; CI case was about 5.01s and the controlled test body is about 0s - TaskSchedulerCanReScheduleExpiredTasks: CI case was about 5.52s; local controlled transition is about 1.23s - TestCheckHealth: CI case was about 4.06s; local test is about 0.5s and now asserts every negative case - persistent cron retry failure: fixed 10s wait removed while preserving exactly 3 failed attempts - CancelableJob: impossible 5s wait removed; local test is about 0.03s - Embedded-cluster group scheduling: matched local race/-short runs improved from 364.41s at -p 1 to 296.83s at -p 2 (18.5%); max RSS stayed flat at 4.396 GB versus 4.393 GB. A measured -p 3 run was slower and was rejected. ## Validation - package partition: 459 total, 459 assigned exactly once, 0 duplicate, 0 missing, 0 extra - embedded-cluster discovery: 10 owners found; after exclusive-group precedence, 8 run in the cluster stage - bash syntax, diff checks, optools test/race/vet passed - exact failed owner: TestTableFeatures race passed twice; full pkg/tests/features race passed - full race packages passed: backup 15.4s, fileservice 28.0s, logservice 127.6s, taskservice 26.9s, TAE DB test 105.9s - adaptive focused race stress passed for the modified fileservice and taskservice cases No runner change and no test coverage reduction.
Summary
Root cause fixed
The failed UT run started pkg/tests/features in the light parallel group even though its test binary transitively imports pkg/embed and owns a complete embedded cluster. It competed with other race test binaries for CPU and memory; HAKeeper startup then timed out/reset before TestTableFeatures reached its assertions.
The previous directory allowlist could regress whenever a new package acquired an embedded-cluster test dependency. The new grouping is derived from go list -race -test and the complete dependency graph, so pkg/tests/features and future cluster owners are classified automatically. Discovery is fail-closed and covered by transitive, partial-scope, and command-failure tests.
Why the test optimizations preserve strength
The optimized tests retain their semantic axes: concurrent ownership and release, every operation type, exact checksum coalescing boundaries, EOF behavior, reader conformance, retry count, expiration transition, cancellation, restart ordering, and failure cleanup. Large OOM reproductions remain available through their existing opt-in environment gate.
Measured impact under race
ConcurrentIOAllocatorPressure: max RSS about 663 MB to 123 MB; retired instructions about 8.69B to 0.47B; wall 6.61s to 1.06s
FuzzingDiskS3: max RSS about 502 MB to 346 MB; retired instructions about 17.30B to 3.12B; wall 6.18s to 1.83s
MultiLayerFileWithChecksum: retired instructions about 12.41B to 4.11B
NewAwsSDKv2: external failure wait removed; CI case was about 5.01s and the controlled test body is about 0s
TaskSchedulerCanReScheduleExpiredTasks: CI case was about 5.52s; local controlled transition is about 1.23s
TestCheckHealth: CI case was about 4.06s; local test is about 0.5s and now asserts every negative case
persistent cron retry failure: fixed 10s wait removed while preserving exactly 3 failed attempts
CancelableJob: impossible 5s wait removed; local test is about 0.03s
Embedded-cluster group scheduling: matched local race/-short runs improved from 364.41s at -p 1 to 296.83s at -p 2 (18.5%); max RSS stayed flat at 4.396 GB versus 4.393 GB. A measured -p 3 run was slower and was rejected.
Validation
No runner change and no test coverage reduction.