Repository navigation
perf(optools): bound embedded race package overlap - #29807
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? |
b09a0e4 to
f5e5b02
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Changes required: the previously reported ARM cancellation failure is not causally closed. Two of the three previous findings are fixed in code; there is one new, nonblocking documentation finding below. No new material production-code defect was established in this review.
Reviewed all changed hunks in the 10-file diff at f5e5b02ec776ac7f52aabda01832cefa897dce4d, against merge-base 8adb9d8f80c5bcbac7de51367faf38178208e937. No source edits or subagents were used.
| Previous finding | Current disposition |
|---|---|
| Two-process default adoption | Fixed. Make and direct-runner defaults are both one; each wave requires its own explicit opt-in. Boundary tests cover independent configuration and invalid/empty values. |
| ARM cancellation lifecycle | Still open. The recorded Linux/arm64 race repetitions on original reviewed commit a6c49f50 failed twice during cleanup, exceeded the harness deadline and required emergency cleanup of three live owned processes; the merge-base control passed. The current Linux/x86 passes, added diagnostics, fail-closed helper protocol and separate HeavyPlan fixture correction do not identify or repair that handoff. This is an unresolved historical failure, not a claim that I reproduced it on f5e5b02e. Diagnose runner versus fixture ownership and retain bounded cancellation/zero-survivor assertions when closing it. |
| Darwin BASHPID compatibility | The identified code defect is fixed. Both harness and executable mocks use the shared caller-assigned PID helper, including the exec/PPID fallback. Native/fallback ownership controls passed. This does not assert that a fresh Darwin suite passed; the current Darwin CI job is skipped. |
Design and engineering assessment:
- Implementation/build delta: +205/-74. The existing dispatcher, admission manager and report consumer retain their responsibilities. Completion acknowledgment proves audited helper cleanup; the report-ready marker proves representation completeness. They carry different obligations, so the added acknowledgment is justified by the abrupt-loss counterexamples. The parent validates acknowledgment/status and drains the still-owned group before PID release; failure retains artifacts and blocks later admission. This contains uncatchable helper loss; it does not reclaim independent groups whose identities died with the helper.
- The two-process cap and conservative exclusive classification bound optional execution. There is no second scheduler, duplicate cluster admission owner or database hot-path work. Removing HAKeeper's test-only allocation path in favor of the real
Updatepath is coherent cleanup. The SQL change remains a test correction: its two-second DROP execution bound is preserved while commit durability uses the existing transaction context, with rollback and contender cleanup retained. - Test delta: +724/-62, reviewed separately. The important additions exercise real runner/admission/report boundaries, abrupt loss, PID identity and rejected consumption/admission; they are not justified merely by their size. The FIFO readiness correction removes an executed fixture race without relaxing cancellation status, drain or report-order assertions. Existing harnesses are reused; no extra embedded SQL cluster fixture was introduced.
- Documentation delta: +98/-28. Measurements are identified as estimates or measured tradeoffs, and unresolved lifecycle work is explicit. The new P3 identifies a real mismatch in the rollback instructions: resetting only the issues flag leaves an explicitly enabled embedded pool active.
Validation evidence:
- Reused still-valid author evidence for this head: full
optoolscoverage/normal and race runs; focused cancellation race repetitions and Bash 5.1 control; SQL normal/race; fresh native build; configured incremental vet/molint/golangci checks with zero issues. Existing negative controls reject missing completion, premature report consumption and unrelated DROP blocked by exclusive G admission. - Fresh reviewer QA used a private Go overlay to replace the completion-file path with a directory after real helper admission and report creation. The real publication write failed. The existing oracles confirmed status 125, retained report/binary, rejected report consumption and later admission, and released the joined PID. Focused race test PASS, 1.028s. No tracked test/source modification remains.
- At the last CI snapshot, Linux UT, coverage, SCA and build were still running; Darwin UT was skipped. Local evidence is not a claim of green CI or ARM closure.
I am narrowing the earlier whole-PR verdict: the unfinished combined 600-second/CPU/memory optimization target is not an independent blocker for this serial-default, opt-in increment. Matched full-wave resource evidence remains necessary before default adoption. The outstanding cancellation failure is a concrete lifecycle validation gap, not a speculative reason to add another scheduler or cleanup framework.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Changes required remain for the existing cancellation validation gap. Three of four previous comment threads are resolved; the ARM cancellation thread is still open. No new material code finding was established.
Reviewed head 4ca696fab27f8c116e92bb564971d5c01c9cd875, declared/fresh main d5faee3681a4d739d5e6e7be62ee4f54af5b09ce, merge-base 8adb9d8f80c5bcbac7de51367faf38178208e937. The executable/test diff versus the previously reviewed f5e5b02e is empty. I read the new documentation hunks, reused the complete ten-file review and valid model/evidence records, and rechecked the owner/consumer terminal paths. No source edits, subagents or test reruns in this review.
| Previous comment | Disposition at this head |
|---|---|
| Default adoption | Resolved. Make and direct-runner defaults remain one, with independent explicit opt-in for each wave. |
| Darwin PID compatibility | Resolved code defect. Caller-assigned portable PID handling covers both harness and executable mocks; ownership/fallback controls passed. Actual Darwin UT remains unverified/skipped, rather than being claimed as passed. |
| Two-wave serial rollback | Resolved. The latest commit correctly scopes slot admission to either opted-in pool and specifies both flags for full serial rollback. |
| ARM cancellation lifecycle | Still open, P2. The recorded cleanup timeouts and live-process emergency cleanup occurred on original reviewed commit a6c49f50; they are not new reproductions on 4ca696fa. Current passing x86 controls do not identify that failure's first stalled boundary or establish a causal repair. No ARM environment is available, as confirmed by the user. |
The design is coherent for its stated containment contract. The dispatcher owns admission and helper PIDs; helpers own their test/watchdog groups; the parent consumer owns final report/artifact consumption. Completion acknowledgment establishes audited cleanup, while report-ready establishes representation completeness. Their distinct purposes justify the added confirmation. It closes executed false-success/unsafe-consumption counterexamples across helper classes instead of adding signal-specific exceptions or a second scheduler. Test-only HAKeeper allocator wrappers were removed and tests now use the authoritative Update path.
| Unhappy-path audit | Assessment |
|---|---|
| Q1: resource ownership | PID publication, helper completion, group drainage and report consumption retain explicit owners. Missing/mismatched completion or failed drainage becomes terminal 125, retains evidence and prevents later admission. Uncatchable helper loss still cannot immediately reclaim independent groups whose identities died with it; the PR documents this containment limitation. |
| Q2: cancellation/termination | Deferred TERM is replayed after publication; all owned groups receive TERM before the common bounded KILL sweep. Real stopped-watchdog controls completed sweep and join under Bash 5.2 and 5.1. The historical cancellation failure remains the unresolved exception requiring causal evidence. |
| Q3: bounded work/state | Pools cap at two, high-footprint/unknown packages remain exclusive, and arrays/acknowledgments are bounded per run under the existing workspace lifetime. No database hot-path work, new queue or persistent protocol is introduced. |
I reviewed the increments separately: implementation/build +205/-74; tests +724/-62; documentation +99/-28. Test size is not itself evidence of quality. The useful cases exercise real runner/admission/consumer boundaries, prove fault admission before asserting outcomes, retain exact cancellation/report/survivor oracles, and reuse fixtures. The FIFO correction removes an executed readiness race without increasing the cancellation deadline. The SQL test retains its two-second statement/admission bound, separates WAL commit latency using an explicit transaction, checks committed visibility and the pending competitor, and retains rollback/contender cleanup. No additional SQL cluster fixture was added.
Performance remains an opt-in tradeoff: the documented matched issues experiment saved 161.84 seconds but increased CPU 30.27% and peak memory 73.02%. This does not prove combined resource improvement. Serial defaults and the adoption gate are appropriate; the unfinished 600-second project is not an independent blocker for this increment. Additional helper confirmation I/O is confined to the existing CI control path.
Still-valid QA evidence includes the actual completion-publication I/O failure control (125, retained artifacts, rejected consumers/later admission), abrupt-loss/early-consumption negative controls, and stopped-watchdog publication controls: native race 6.856s, coverage-mode fixture 5.863s, and Bash 5.1 caller/mocks race 6.917s. These preserve the fault-reach, exact identity, 143, drain/join and zero-survivor assertions. Owning optools coverage/race, SQL normal/race, HAKeeper/native and configured incremental SCA remain valid because their semantic inputs are unchanged.
New CI evidence at executable revision f5e5b02e: coverage passed and arm64 SCA passed. Its CI Required failure reports matrixone-ci: cancelled; this is the aggregate result of cancelled dependencies, not a newly observed test failure. Current-head UT, coverage, SCA and build are still running; Darwin UT is skipped. No whole-CI pass is claimed.
The remaining action is precise: obtain a failing cancellation execution that identifies fixture release, helper TERM receipt/publication replay, group sweep or child join as the first stalled edge, then repair that owner and retain the bounded cancellation/zero-survivor assertions. Another passing stress run or speculative cleanup framework would not close this comment. This review adds no duplicate inline finding.
Deep review conclusion — rebased head
|
| Check | Result |
|---|---|
| Full pkg/embed normal, short/matrixone_test/count=1, Darwin/arm64 Go1.27.1 | PASS 384.781s; 113 top-level passes |
| Full pkg/embed race, same configuration | PASS 441.801s; 113 top-level passes, no race report |
| TestIssue29400CopyAlterRetainedGatePromotionFastFails normal | PASS 9.88s, both gate scenarios |
| Same conflict test race | PASS 10.40s, both gate scenarios |
| No-init Linux/arm64 coverage-mode cancellation + snapshot tests | PASS 28.969s; 15 repetitions, four cancellation stages and eight snapshot cases per repetition |
| bash -n and complete-range git diff --check | PASS |
Full embed validation includes the paired CDC suites followed by EndTs in the same process, configuration boundaries, UPDATE coverage and upgrade/restart. The pre-existing external MySQL8 opt-in BVT was skipped because its endpoint was not configured; it is not counted as a pass.
Reused evidence was checked for semantic freshness: all optools implementation/tests, HAKeeper changed files and Go module inputs are unchanged by rebase. Prior full optools normal/race results on native system Bash3.2 and no-init Linux/arm64 Bash5.2 remain applicable. The ARM mitigation also has two race100 passes in the original failure environment. Coverage-mode optools reports no Go statements; it does not measure Bash branch coverage.
Review comments and remaining acceptance boundaries
All four review threads are now resolved. The ARM thread's latest closure explanation records the failure boundary, correction and relevant race/coverage evidence. Precise historical Bash signal causality and ARM-only scope remain unproved diagnostic limits. No current counterexample was found. An uncatchably killed helper still preserves evidence and rejects later admission; immediate reclamation of its independent groups is not claimed.
The three pre-rebase matched race pairs for the selected equivalent scenarios showed median wall 210.11 -> 122.40s (-41.7%), CPU 87.18 -> 69.58s (-20.2%), peak footprint 2.997 -> 2.277 GB (-24.0%) and cluster starts 5 -> 3. These are historical subset measurements supporting the design; they are not rebased whole-CI performance proof.
Whole-CI savings of at least 600 seconds and combined issues/embedded full-wave CPU/memory acceptance remain open. Existing two-process issues results increased CPU and peak memory, so retaining serial defaults is appropriate. At the end of this review, the rebased full CI had not reached terminal results. This review does not count pending CI as passed or claim completion of the larger optimization target.
What type of PR is this?
Which issue(s) this PR fixes:
Related #29562. Original CPU/memory and CI-time acceptance remain open; this PR does not close that issue.
What this PR does / why we need it:
Keep one race-UT runner and the existing coverage, test inventories and required multi-CN cases. Reuse the existing dispatcher for bounded issues/embedded execution; defaults remain serial on every platform, with independent explicit two-process opt-ins until matched resource acceptance passes. Preserve conservative exclusion across package reordering. Remove test-only HAKeeper allocator wrappers and use the authoritative allocator.
Helper ownership correction
A helper's exit code cannot prove its separately admitted test/watchdog groups have stopped: live-child reproduction demonstrated unsafe report/artifact deletion after PIPE, HUP, KILL, explicit exit and nounset, including exits numerically matching ordinary success/failure. Compilation and ordinary issues fallback also had descendant-lifetime gaps.
CI fixture corrections
The rebase retains main's pre-opened, pinged progress connection for unrelated DROP. Its oracle proves independent progress while the competing lifecycle owner remains blocked; it does not impose a two-second SQL/commit timing requirement. The obsolete separate-transaction workaround is removed. Contender liveness, deadlock-victim, rollback and surviving-transaction assertions remain.
The cancellation mock published a readiness file through an external command and then repeatedly launched sleep processes. An executed private control showed that the file could be visible while the helper was still waiting for that external command, deferring its TERM trap beyond the fixture's four-tick grace. Replace that boundary with the existing FIFO/builtin-read pattern. Preserve the grace, harness deadline, 143 exit, complete report ordering, checked completion publication and survivor rejection. This closes the demonstrated fixture counterexample; the historical CI child's exact state is not established. Production runner behavior is unchanged by these fixture corrections.
Documentation correction
Both explicitly enabled waves use shared-gate/slot admission. The design now describes that scope and documents
UT_ISSUES_BATCH_PARALLEL=1 UT_EMBEDDED_PACKAGE_PARALLEL=1for complete serial rollback; changing the issues flag alone does not disable embedded pooling.Embedded workload and ARM cleanup follow-up
Validation before rebase
The results below apply to pre-rebase revision f5ecd91. Rebased revision d5ffd2a is based on main 590601d; rebase had one lifecycle-test conflict, and new CI plus affected validation are pending.
Pre-rebase follow-up checks on Darwin/arm64, Go1.27.1, source-matched native artifacts, repository CGo runner, matrixone_test/short/count1, GOMAXPROCS8:
Three matched selected-workload race comparisons on Darwin/arm64, Go1.27.1, matrixone_test/short/count1, GOMAXPROCS8, with prebuilt binaries and serialized fresh test processes:
All three comparisons passed. These are selected local execution measurements, excluding compilation. They establish neither whole-CI savings nor the original 600-second acceptance target.
Open acceptance
Related #29562 remains open. Defaults remain serial; full CI time and combined CPU/memory acceptance require matched CI measurements. Latest prior UT step took 88m09s with both wave concurrency settings at one. New-revision CI is pending.
Previously failing Linux/arm64/no-init cancellation had two failures in 100 runs. The snapshot candidate passed two race100 runs and owning-package checks in that environment. The exact intermittent Bash/signal root cause remains unproved; this is tested mitigation, not proof of ARM-only causality. Preserve existing completion evidence and refusal to admit subsequent work after failed drain. An uncatchably dead helper cannot immediately reclaim independent groups whose identities were held only by that helper.