Repository navigation
fix(spill): retain JOIN and HashBuild cleanup ownership on errors - #30102
Ariznawlll wants to merge 63 commits into
Conversation
Retry transient file removal for JOIN and GROUP spill. Preserve failed bucket and writer ownership for later cleanup, and propagate JOIN cleanup errors. Cover normal, transient, and persistent failure paths with focused tests.
…odex/spill-cleanup-retry
Replace the superseded retry design with anonymous unlink-before-publish, synchronous named cleanup, sticky root exclusion and terminal disk abandonment. Preserve distinct GROUP and JOIN/HashBuild ownership oracles in focused regressions. Revision 4 was explicitly approved by the task owner. This is a local implementation checkpoint: final post-edit race/static validation and push remain blocked by insufficient local disk space, as recorded in the verification document.
|
|
|
|
|
|
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 8980d414396686842035ac0bd38bc9c1a16be161
Assessment: approve
Reviewed the complete 37-file delta and all 21 discussion items. Prior ownership and design concerns are resolved or superseded by the approved local lifecycle. No actionable unresolved defects found.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Verified the approved design blob, cleanup/accounting ownership, admission fencing, and shutdown ordering.
-
Reused supplied exact-head CI successes for build, Ubuntu UT, static analysis, coverage, and multi-CN BVT.
-
Isolation preflight passed: preflight.log and checks/1793264586771687831-2.json.
-
Record-integrity checks passed: review-integrity.log and checks/1793265104284743483-2.json. Source remains unchanged; discussion-assessment.json covers every discussion key.
Limitations:
-
Local focused tests stopped before compilation because libmo.so was missing and available native artifacts failed provenance matching; fileservice-focused.log and checks/1793264666222051245-2.json record exit 1. No local Go test pass is claimed.
-
CI evidence contains statuses, not raw per-case logs. Author-reported Darwin repetition totals were not independently verified.
-
Whole-CN fault/restart recovery and performance acceptance were not independently exercised.
结论本轮本地测试通过。已正常推送 关键证据
待解决点推送触发的自动 CI 正在运行,尚未声明全部通过;仍需相关 reviewer 复审原有 CHANGES_REQUESTED。真实 SQL/BVT、Linux 运行时、整 CN 故障/重启恢复与性能验收未在本机执行。本轮未手动触发 CI、部署或共享环境测试,未 force push、合并/关闭 PR、approve、dismiss review 或解决评论线程。 |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 080249fa56041598a7ab7b6471343bf229fc4885
Assessment: request_changes
The approved cleanup design reuses existing owners and budget tokens with bounded lease/fence state. One integration defect remains: bundled CNs share LOCAL, so the new lease prevents the second CN from initializing. This newly traced consumer changes the earlier approval.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P1
cmd/mo-service/main.go:936: Start the documented launch-multi-cn or launch-with-proxy manifest. Both CN configurations explicitly use LOCAL data-dir mo-data/local2.
Impact: The first CN holds the exclusive scratch lease; the second returns ErrSpillRootOwned and aborts cluster startup. Isolate these CNs' scratch roots, for example through distinct LOCAL directories, and add a two-CN initialization regression while retaining lease exclusion.
Evidence: Both layouts' cn1.toml and cn2.toml share the LOCAL path. launch.go:156-181 starts them in one process; config.go:629-641 preserves explicit directories. The production-initializer probe reproduced second-CN rejection in both layouts; changing only its LOCAL directory allowed both initializations. Evidence: probe_multicn_startup_v1_test.go, multicn-startup-probe-v1.jsonl and checks/1794226807962642118-4.json.
Validation:
-
Reviewed all 38 changed files, 24 discussion entries and four linked issues. The approved design blob matches its record; discussion-assessment.json covers every discussion key once.
-
Isolation preflight passed. Native prerequisites matched 198 current inputs and 34 output hashes.
-
All 11 owning packages passed normally; nine passed full race runs. validation-summary.json maps successful package results to command receipts and logs.
-
Six exact concurrency tests passed 486 adaptive race repetitions. The WINDOW cancellation/reuse test passed atomic coverage.
-
Whitespace, changed-file gofmt and make err-check passed. Final audit verified the frozen head, clean source and receipt/log correspondence: checks/1794227079976444278-5.json.
Limitations:
-
Full GROUP and HashJoin race runs hit the 300-second limit; remaining recovery was interrupted after the startup blocker converged. No full race pass is claimed for those packages.
-
The initializer probe used private paths and MEM non-LOCAL stores. Whole-CN boot/restart, production fault injection and performance validation were not run. Supplied compose CI success does not cover this single-process shared-LOCAL topology.
|
Tick the box to add this pull request to the merge queue (same as
|
aunjgr
left a comment
There was a problem hiding this comment.
Re-review of 080249fa56041598a7ab7b6471343bf229fc4885.
The old shared-queue/lifecycle design blocker is resolved by the explicitly approved revision-4 local lifetime contract. Anonymous descriptors are not published until unlink succeeds. Named producers, handoffs, rejected payloads, popped buckets and terminal consumers retain one effective destruction owner. Failed removal fences further creation and conservatively abandons the shared disk token without retaining the ended query.
Q1 ownership and Q3 bounded retained state close; Q2 fenced admission remains independent of blocked cleanup. OS syscall completion deadlines are explicitly outside the accepted contract, not newly claimed here. No remaining code blocker found.
Supplementary Linux CPU validation at this head passed: focused root/message/budget checks; terminal cleanup regressions in message plus six colexec consumer packages; 100 repetitions of TestSpillRootFencedAdmissionDoesNotWaitForCleanup under race; and one short race run of fileservice, message and process. Prior source-qualified author evidence is reused for unchanged boundaries. This is not a fresh SQL/BVT, whole-CN restart, performance or hosted-CI acceptance claim.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 735ef35cb59009edffe9d437eef2cffbafe09f88
Assessment: request_changes
The previously reported multi-CN startup failure remains open, and spill cleanup now strips structured retry error codes. The accepted synchronous cleanup and root-fencing design reuses existing reservation ownership and avoids a background retry queue, but its lease must coexist with supported launch configurations.
Model: gpt-6.1-terra / max
Session: 01a212e9-10a4-7203-9194-162fe0e55042 · slot 0 · generation 13
-
P1
cmd/mo-service/main.go:361: Start either bundled two-CN launch configuration. Both CNs use the same LOCAL directory, and each now acquires an exclusive spill-root lease during initialization.
Impact: The second CN fails initialization with “spill scratch root has another live owner,” so the bundled multi-CN and proxy launch configurations cannot start. This occurs before any query spills.
Evidence: The existing concern in reviews:5825840033 remains reproducible. The current initializer probe fails for both shared-LOCAL layouts and passes with isolated roots; a separate DISK-V2 lease probe reproduces the same result. See review-probes.log and diskv2-probe.log. Give concurrent CNs distinct scratch roots while retaining exclusive cleanup ownership. -
P2
pkg/sql/colexec/spillutil/join_spill.go:1709: A probe child or join-key evaluation returns a structured MatrixOne error while a spilled join scatters its probe input, even when every writer closes successfully.
Impact: errors.Join wraps the primary error even when cleanup returns nil. MatrixOne’s retry and pipeline serialization paths require a direct *moerr.Error, so a retryable RC error is no longer retried and is serialized as a generic internal error.
Evidence: The focused scatter probe returns *errors.joinError; moerr.IsMoErrCode rejects the retry code, and pipeline serialization changes code 20628 to 20101. See review-probes.log, pkg/common/moerr/error.go:990 and pkg/pb/pipeline/pipeline.go:108. Preserve the primary error when cleanup succeeds, and preserve appropriate MatrixOne classification when reporting simultaneous cleanup failures.
Validation:
-
Private-runtime preflight passed; receipt checks/1795625651030704744-2.json and preflight.log.
-
Reused the earlier native build after matching 195 tracked native inputs; see native-inputs.log and checks/1795625688088712794-2.json.
-
Selected cleanup and ownership tests passed across ten packages; see targeted-tests.log and checks/1795626129771710461-2.json.
-
Focused race tests passed for root fencing, lease shutdown, concurrent close and abandoned reservations; see race-tests.log and checks/1795626471558492078-2.json.
-
Selected process, window and frontend spill-consumer tests passed; see consumer-tests.log and checks/1795626701308556696-2.json.
-
The initializer and retry-identity probes failed as described; see review-probes.log and checks/1795625901532458547-2.json. The DISK-V2 lease probe also reproduced the shared-root failure with an isolated-root control; see diskv2-probe.log and checks/1795626831806007238-2.json.
Limitations:
-
The full DISK-V2 initializer repeat timed out before producing test output; the narrower DISK-V2 lease probe completed. No full cluster launch or end-to-end SQL retry was run.
-
Author-reported Darwin validation did not include matching retained receipts in the supplied local validation evidence.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #30097. Fixes #30098. Fixes #30100. Fixes #30103.
Current head and verification (2026-12-03)
Head
fa509be249integrates main3a1d7780c7. The two bundled CNs now use distinct LOCAL directories through #30814. An intentionally duplicated physical root still requires exclusive ownership.The additional code change preserves the original error when spill cleanup succeeds. Before the change, the ordinary probe-scatter regression received a Go wrapper around the MatrixOne transaction retry error. It now receives the original typed error, while a simultaneous cleanup failure retains both causes. Producer and post-handoff cleanup remain covered independently. Named-file unlink failures retain the disk charge and fence the affected root; recovery uses CN restart and startup cleanup under the existing design.
spill.sql).pkg/embedsuite passed in 359.648 s, including the current publication-lock fixture corresponding to the previous Ubuntu CI failure.What this PR does / why we need it:
Consolidated candidate for #30099 and #30102. Both branches carry the same implementation, including the distinct JOIN/HashBuild regression oracles; they are not independent fixes.
Anonymous spill descriptors are published only after successful unlink. Named GROUP/HashBuild/JOIN files keep FD rotation and are deleted synchronously by their terminal owner. A removal failure fences further spill creation for that root and preserves conservative disk charges without retaining ended queries or background retry callbacks. Recovery requires old owners to stop, successful startup cleanup and a fresh CN process.
The directing user approved design revision 4; the approval record identifies the exact artifact and availability tradeoff. This is not an assertion of approval by GitHub maintainers; the prior reviews remain for human re-review.
Updated to main
9e29011e7313a57962adc00963baa659d1e81e37without rewriting history. Follow-up0fc9b99adf:moerrconstructors while preserving distinct error sentinels and cleanup causes; retain main's index-cache shutdown alongside spill-root shutdown.Validation
Local Darwin/arm64, Go 1.27.1, repository-controlled native build and provenance with verified pinned dependencies:
go vet,make err-check, gofmt and diff checks pass. Configured incremental SCA completes with Go 1.27.1-built pinned tools; golangci-lint v2.14.0 reports 0 issues under the unchanged repository configuration. Molint emits non-failing diagnostics in two unchanged main files (disk_cache_async.go,window.go).Limits
No Linux runtime, whole-CN restart, SQL/BVT, shared-cluster/production fault injection or performance acceptance was run locally. Private lease tests do not certify whole-CN recovery. Push-triggered CI is separate from local evidence; no workflow was manually dispatched, and pending or skipped checks are not claimed as passes.