Repository navigation
test(morpc): synchronize client gc tests - #29674
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.
Review decision: changes required. Submitted as COMMENT because the authenticated account is this PR's author and GitHub rejects self-REQUEST_CHANGES reviews.
Reviewed the complete diff at dc6fecb against f20f5ca, including manager admission, worker processing, stop/drain and backend cleanup ownership.
The overall simplification is sound: idle-GC assertions are stronger, the real getBackend path remains exercised, and the integration sleep had no independent oracle. Production and docs are unchanged; tests are +35/-60, net -25. There were no outstanding human review comments to resolve.
One test-protection regression remains: stopping the manager before observing the unregistered-client result can bypass the eligibility check the test is intended to prove. This is demonstrated by the same production mutation passing the new test and failing the base test, not a speculative concern.
Validation on Go 1.27.0 / darwin-arm64: full morpc package with -race passed (15.201s); directly changed GC scenarios passed individual -race repetitions (100 each). External overlay probe with GOMAXPROCS=1 and the worker registration guards disabled: head test PASS, base test FAIL (backend count 1 instead of 0). No repository source was edited for the probes. Normal green/race results do not catch this lost negative oracle.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Decision: APPROVE / no blocking finding at 592587342c2d7085debc5248bb5eecdb9f150d18, against f20f5ca147c44b012343d0f48dfcd84b6a5986a1. COMMENT is used because GitHub does not allow the authenticated PR author to approve their own PR.
Reviewed the complete one-file delivery diff and its manager admission, registration, generation completion, stop/drain and client cleanup consumers. The registration comment is resolved: the admitted state's completion is observed while the manager is live, then independent factory-count and backend-pool oracles reject unauthorized creation. Idle removal and eventual backend destruction remain distinct assertions. Cleanup completes the owned workers; no production state, storage, execution path or runtime cost is added.
The latest test-only increment passes normal and individually selected race count100. The external registration-bypass control fails at the factory-count assertion without an alarm. Still-valid owning morpc normal/race and incremental SCA evidence is reused for unchanged inputs; latest-head Linux UT/SCA and CI Required are SUCCESS. Implementation/docs unchanged; tests +65/-87 (net -22). The extra inactive enqueue has no distinct effect oracle and is non-blocking cleanup, not additional claimed coverage.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Decision: APPROVE / no blocking finding at 5925873 against f20f5ca. Main-session deep review only; no subagents. Submitted as COMMENT because this is a self-authored PR. No merge.
The existing client/generation/create-state.done remain the admission and completion authorities. The fixed unregistered-client test waits for that exact request to finish while the manager is live, then checks both zero factory calls and no published backend. Shutdown cannot supply a false negative oracle. Closed-client admission is checked directly; synthetic closed state is restored only after its manager stops and the original owner can close the client. Idle/inactive cleanup checks actual backend removal and the relevant destructor outcome, replacing scheduler sleeps without another state machine or fixture.
The original P2 comment is resolved with causal evidence: exact-head normal/race100 and registration-guard bypass controls from the prior main-session review remain valid by identical complete diff fingerprint; the bypass fails at the factory-call assertion without a process alarm. Full owning normal/race/SCA evidence is retained, and latest Ubuntu UT, Linux SCA and CI Required are SUCCESS. All changed hunks and cleanup owners were reconciled.
Production0, tests+65/-87(net-22), docs0. Deleted delays had no independent oracle; retained scenario identities cover actual async creation, idle-duration exclusion, terminal cleanup and registration rejection. No production runtime/performance contract changes, SQL/wire/disk/auth/compatibility changes, or mandatory architectural-design trigger.
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: Refs #29249 (ongoing test-quality work; this PR does not close the tracking issue). ## What this PR does / why we need it: Remove disconnected implementation and test scaffolding, and replace clock waits with observable behavior without weakening the retained oracles. - Remove the unused Go async worker pool and private merge simulator, along with their disconnected tests. Retain the real thread-pool executor and production merge scheduler; move the existing clock implementation without changing its behavior. - Remove commented-out, skipped diagnostic scaffolding and orphan helpers where they have no active test value. Preserve active checkpoint, GC, replay, transaction and restart checks; re-enable meaningful non-voting replica and delete/restart tests. - Exercise exporter contents directly and lifecycle separately. In the collector test, assert threshold-triggered SQL publication **before** stopping, then assert pending-buffer drainage after graceful stop. Both waits are bounded and cleanup is registered immediately. - Synchronize asynchronous tests on their actual completion/publication oracles, including jobs, backend creation and logtail cancellation. Keep main's canonical GC tests from #29674 intact, including unregistered-client, idle-close and failure-cleanup assertions. - Keep prebuild tests independent of host free disk while retaining a separate low-disk rejection check and real child-process cleanup assertions. Final delta against main: 26 files, +483/-4914 lines. No SQL, protocol or persistent-data-format changes. Existing data compatibility is unchanged; mixed-version operation is not part of this change. ### Validation - Complete delivery-diff selection: 16 affected/direct-consumer packages, including packages containing deleted tests and the real scheduler's owning DB consumer. Normal UT and race UT both passed (15 test packages; 3,372 test/subtest pass events each, five existing skips). Both use `-short -tags matrixone_test -count=1` with the repository CGo wrapper; the testutil support package is compiled but contains no tests. The skipped tests are not claimed as validated. - Incremental formatting/diff checks, `go vet`, the repository-pinned `molint`, and configured golangci-lint 2.14.0 against the final main base. - Collector and auto-create tests: 100 race-mode repetitions each. - Independent white-box negative controls: disabling threshold publication fails the pre-stop assertion; disabling shutdown drainage fails the post-stop assertion. Both terminate with cleanup rather than hanging. - Design and final complete-change review use `gpt-6.1-sol` with `xhigh` reasoning. Local terminal evidence is recorded independently of remote CI. Removing fixed waits reduces avoidable test delay, but this PR does not claim a measured whole-suite or production performance improvement. Remote CI is not used as a substitute for the local gates.
What type of PR is this?
Which issue(s) this PR fixes:
Refs #29249
What this PR does / why we need it:
Make the global morpc client-GC tests observe the actual backend state and cleanup completion instead of sleeping for fixed intervals.
require.Eventuallyover the sameclient.getBackendentrypoint and a bounded one-second deadline.doGCIdleowner and assert both pool detachment and the backend's eventualCloseeffect.Only
client_gc_test.gochanges. No production code, GC ownership, worker scheduling, or cleanup path was changed.Coverage and design mapping
client.getBackendentrypoint reaches a non-nil backend or fails within a bounded assertiondoGCIdlesynchronously removes the idle slot and the owned backend eventually reportsclosed0or1)Validation
Go 1.27.0, Darwin arm64, repository-supported runner and provenance-verified native artifacts:
go test -race -p 1 -count=1 ./pkg/common/morpcpassed locally (15.671 s).-race -count=100.gofmt,git diff --check, affected-packagego vet, configuredmolint, and golangci-lint 2.14.0 incremental checks passed.No production or documentation changes; tests are +65/-87 (net -22). These are package-level checks, not a business-workload or total CI performance claim. New-head CI is pending.
Additional local verification after the live-state oracle change:
go test -p 1 -count=3 -run '^TestGlobalClientGC_UnregisteredClientIgnored$' ./pkg/common/morpc: passed.go test -race -p 1 -count=5 -run '^TestGlobalClientGC_UnregisteredClientIgnored$' ./pkg/common/morpc: passed.go test -p 1 -count=1 ./pkg/common/morpc: passed (13.897 s).gofmtandgit diff --check: passed.