Repository navigation
fix(dedupjoin): preserve parallel finalize failures - #26393
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? |
|
Self-review completed on exact head Found and fixed a production concurrency blocker in the original head: parallel finalize workers shared one mailbox but had no per-spill-bucket round barrier, so a fast worker could publish bucket N+1 before a slow worker published N and the merger could combine bitmaps from different buckets. The fix adds a mailbox-owned round completion channel: publication transfers ownership once, every worker waits for the merger to collect the complete round, cancellation unblocks the wait, and reset creates a fresh round. This is protocol-level synchronization, not a worker-count/test special case. Unhappy paths covered: delayed worker, cancellation after publication, repeated Reset/Free, and abort draining. No steady-state row-processing cost was added; the extra channel synchronization happens only once per spill bucket during finalize. |
|
Follow-up test-only head |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No findings. The explicit mailbox protocol preserves cancellation and worker errors, prevents partial finalize output after abort, linearizes capture ownership with shutdown, bounds waits through cancellation/stop, separates spill rounds, and isolates prepared-execution generations. Local tests and vet could not run because the checkout lacks required CGo libraries and headers; the worktree remains clean.
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 6d90f3e. No merge-blocking correctness, concurrency/lifecycle, compatibility, or normal-business regression issue was found in this diff.
The mailbox protocol has a clear ownership linearization point under the stop/send lock; all capture states retain exactly one cleanup owner. Worker waits terminate through round completion, cancellation, or merger stop, and the all-participant Reset barrier prevents a stopped generation from reopening while an old participant remains active. Dynamic error/cancellation paths stop without emitting partial unmatched-build output.
Verified all 20 added/modified focused tests individually under adaptive race stress (T below timer resolution, B=30s, N=100), full dedupjoin and compile packages under normal and race builds, plus build, vet, and diff checks. Current GitHub checks are green.
…6418) This reverts squash commit `538a45b37d7162182734c943c59bbbd723da3508` from #26331 at the author request. The revert removes the multi-reference CTE reuse planner, query-scoped materialized source and spill path, and the associated compile/Dispatch/Merge wiring as one complete unit. Multi-reference CTEs return to independent inline planning, and sink scans use the existing streaming pipeline path. The revert is synchronized with current `upstream/main` (`2c9608dd45960126ff3a91fc3bbb0addd53d816d`). Later overlapping fixes #26357 and #26393 remain present. There is no SQL syntax, protobuf, public API, or persistence-format change. ### Validation Exact head `fb1b16f27b9665203197678f385815755b143b06`: - previous head `d693b810af44d4d9f0ae22ad3b18d68e78e6dc06`: all major functional CI jobs passed; Matrixone Utils Coverage alone failed because modified-line coverage was exactly 75%, while the gate requires strictly greater than 75% - added `TestDispatchResetSkipsInvalidRemoteReceiversAndNotifiesHealthyPeer`, covering both nil receiver and nil error-channel guards while proving that a later healthy receiver still receives the original terminal error - focused coverprofile: `pkg/sql/colexec/dispatch/types.go:227.33,234.14` changed from count 0 in CI to count 1 locally - exact-head remote Coverage: PASS with 4/4 modified lines covered (`pr_coverage=1.0`, threshold `>0.75`) - affected planner/compile/dispatch/merge package tests: PASS - complete affected owning packages under `-race -count=1`: PASS - focused dispatch terminal and compile sink-scan tests under `-race -count=20`: PASS - affected package build and vet: PASS - `git diff --check`: PASS - exact reverse/overlap audit: only later #26357 and #26393 edits remain relative to the #26331 parent - schema-v4 preflight: `PASS review=PASS validation=PASS` BVT: the previous exact-head Proxy multi-CN and pessimistic BVT jobs passed. This follow-up adds package-internal unit coverage only and does not change product behavior. ### QA decision QA required: yes. This rolls back optimizer selection and the materialized fan-out execution path. CI and environment-level analytical-query regression coverage should complete before merge. Approved by: @XuPeng-SH
## What changed - preserve context cancellation and explicit worker failures during parallel `dedupjoin` finalization instead of reporting a successful end-of-stream - distinguish normal early aborts from errors and prevent incomplete unmatched-build output from escaping - make worker publication non-blocking and linearize it with merger shutdown so captured vectors always have exactly one owner - drain transferred capture state on every terminal path and retain local ownership when publication is rejected - keep the mailbox reusable across spill buckets and prepared executions with an all-participant Reset generation barrier - scope shared mailboxes to one parallel operator-duplication generation instead of mutating the reusable template ## Why The old `nil` message protocol represented context cancellation, channel close, and normal abort with the same value. The merger consequently swallowed cancellation and could silently omit finalize output. It also made failure cleanup and capture ownership ambiguous. The new protocol carries an explicit abort/error status. Sender publication never waits, merger receive remains context-cancellable, and abort/error paths stop immediately without waiting for missing workers. ## Tests - full `pkg/sql/colexec/dedupjoin` package - full `pkg/sql/colexec/dedupjoin` package under `-race` - focused cancellation, ownership, generation-reuse, and data-correctness tests under `-race -count=100` - `pkg/sql/compile` mailbox-generation duplication test - `go vet` for `pkg/sql/colexec/dedupjoin` and `pkg/sql/compile` All new unhappy-path tests complete in milliseconds; no sleeps, retries, external services, or full-suite stress loops are used. Fixes matrixorigin#26375
…#26331)" (matrixorigin#26418) This reverts squash commit `538a45b37d7162182734c943c59bbbd723da3508` from matrixorigin#26331 at the author request. The revert removes the multi-reference CTE reuse planner, query-scoped materialized source and spill path, and the associated compile/Dispatch/Merge wiring as one complete unit. Multi-reference CTEs return to independent inline planning, and sink scans use the existing streaming pipeline path. The revert is synchronized with current `upstream/main` (`2c9608dd45960126ff3a91fc3bbb0addd53d816d`). Later overlapping fixes matrixorigin#26357 and matrixorigin#26393 remain present. There is no SQL syntax, protobuf, public API, or persistence-format change. ### Validation Exact head `fb1b16f27b9665203197678f385815755b143b06`: - previous head `d693b810af44d4d9f0ae22ad3b18d68e78e6dc06`: all major functional CI jobs passed; Matrixone Utils Coverage alone failed because modified-line coverage was exactly 75%, while the gate requires strictly greater than 75% - added `TestDispatchResetSkipsInvalidRemoteReceiversAndNotifiesHealthyPeer`, covering both nil receiver and nil error-channel guards while proving that a later healthy receiver still receives the original terminal error - focused coverprofile: `pkg/sql/colexec/dispatch/types.go:227.33,234.14` changed from count 0 in CI to count 1 locally - exact-head remote Coverage: PASS with 4/4 modified lines covered (`pr_coverage=1.0`, threshold `>0.75`) - affected planner/compile/dispatch/merge package tests: PASS - complete affected owning packages under `-race -count=1`: PASS - focused dispatch terminal and compile sink-scan tests under `-race -count=20`: PASS - affected package build and vet: PASS - `git diff --check`: PASS - exact reverse/overlap audit: only later matrixorigin#26357 and matrixorigin#26393 edits remain relative to the matrixorigin#26331 parent - schema-v4 preflight: `PASS review=PASS validation=PASS` BVT: the previous exact-head Proxy multi-CN and pessimistic BVT jobs passed. This follow-up adds package-internal unit coverage only and does not change product behavior. ### QA decision QA required: yes. This rolls back optimizer selection and the materialized fan-out execution path. CI and environment-level analytical-query regression coverage should complete before merge. Approved by: @XuPeng-SH
## What changed - preserve context cancellation and explicit worker failures during parallel `dedupjoin` finalization instead of reporting a successful end-of-stream - distinguish normal early aborts from errors and prevent incomplete unmatched-build output from escaping - make worker publication non-blocking and linearize it with merger shutdown so captured vectors always have exactly one owner - drain transferred capture state on every terminal path and retain local ownership when publication is rejected - keep the mailbox reusable across spill buckets and prepared executions with an all-participant Reset generation barrier - scope shared mailboxes to one parallel operator-duplication generation instead of mutating the reusable template ## Why The old `nil` message protocol represented context cancellation, channel close, and normal abort with the same value. The merger consequently swallowed cancellation and could silently omit finalize output. It also made failure cleanup and capture ownership ambiguous. The new protocol carries an explicit abort/error status. Sender publication never waits, merger receive remains context-cancellable, and abort/error paths stop immediately without waiting for missing workers. ## Tests - full `pkg/sql/colexec/dedupjoin` package - full `pkg/sql/colexec/dedupjoin` package under `-race` - focused cancellation, ownership, generation-reuse, and data-correctness tests under `-race -count=100` - `pkg/sql/compile` mailbox-generation duplication test - `go vet` for `pkg/sql/colexec/dedupjoin` and `pkg/sql/compile` All new unhappy-path tests complete in milliseconds; no sleeps, retries, external services, or full-suite stress loops are used. Fixes matrixorigin#26375
…#26331)" (matrixorigin#26418) This reverts squash commit `538a45b37d7162182734c943c59bbbd723da3508` from matrixorigin#26331 at the author request. The revert removes the multi-reference CTE reuse planner, query-scoped materialized source and spill path, and the associated compile/Dispatch/Merge wiring as one complete unit. Multi-reference CTEs return to independent inline planning, and sink scans use the existing streaming pipeline path. The revert is synchronized with current `upstream/main` (`2c9608dd45960126ff3a91fc3bbb0addd53d816d`). Later overlapping fixes matrixorigin#26357 and matrixorigin#26393 remain present. There is no SQL syntax, protobuf, public API, or persistence-format change. ### Validation Exact head `fb1b16f27b9665203197678f385815755b143b06`: - previous head `d693b810af44d4d9f0ae22ad3b18d68e78e6dc06`: all major functional CI jobs passed; Matrixone Utils Coverage alone failed because modified-line coverage was exactly 75%, while the gate requires strictly greater than 75% - added `TestDispatchResetSkipsInvalidRemoteReceiversAndNotifiesHealthyPeer`, covering both nil receiver and nil error-channel guards while proving that a later healthy receiver still receives the original terminal error - focused coverprofile: `pkg/sql/colexec/dispatch/types.go:227.33,234.14` changed from count 0 in CI to count 1 locally - exact-head remote Coverage: PASS with 4/4 modified lines covered (`pr_coverage=1.0`, threshold `>0.75`) - affected planner/compile/dispatch/merge package tests: PASS - complete affected owning packages under `-race -count=1`: PASS - focused dispatch terminal and compile sink-scan tests under `-race -count=20`: PASS - affected package build and vet: PASS - `git diff --check`: PASS - exact reverse/overlap audit: only later matrixorigin#26357 and matrixorigin#26393 edits remain relative to the matrixorigin#26331 parent - schema-v4 preflight: `PASS review=PASS validation=PASS` BVT: the previous exact-head Proxy multi-CN and pessimistic BVT jobs passed. This follow-up adds package-internal unit coverage only and does not change product behavior. ### QA decision QA required: yes. This rolls back optimizer selection and the materialized fan-out execution path. CI and environment-level analytical-query regression coverage should complete before merge. Approved by: @XuPeng-SH
## What changed - preserve context cancellation and explicit worker failures during parallel `dedupjoin` finalization instead of reporting a successful end-of-stream - distinguish normal early aborts from errors and prevent incomplete unmatched-build output from escaping - make worker publication non-blocking and linearize it with merger shutdown so captured vectors always have exactly one owner - drain transferred capture state on every terminal path and retain local ownership when publication is rejected - keep the mailbox reusable across spill buckets and prepared executions with an all-participant Reset generation barrier - scope shared mailboxes to one parallel operator-duplication generation instead of mutating the reusable template ## Why The old `nil` message protocol represented context cancellation, channel close, and normal abort with the same value. The merger consequently swallowed cancellation and could silently omit finalize output. It also made failure cleanup and capture ownership ambiguous. The new protocol carries an explicit abort/error status. Sender publication never waits, merger receive remains context-cancellable, and abort/error paths stop immediately without waiting for missing workers. ## Tests - full `pkg/sql/colexec/dedupjoin` package - full `pkg/sql/colexec/dedupjoin` package under `-race` - focused cancellation, ownership, generation-reuse, and data-correctness tests under `-race -count=100` - `pkg/sql/compile` mailbox-generation duplication test - `go vet` for `pkg/sql/colexec/dedupjoin` and `pkg/sql/compile` All new unhappy-path tests complete in milliseconds; no sleeps, retries, external services, or full-suite stress loops are used. Fixes matrixorigin#26375
…#26331)" (matrixorigin#26418) This reverts squash commit `538a45b37d7162182734c943c59bbbd723da3508` from matrixorigin#26331 at the author request. The revert removes the multi-reference CTE reuse planner, query-scoped materialized source and spill path, and the associated compile/Dispatch/Merge wiring as one complete unit. Multi-reference CTEs return to independent inline planning, and sink scans use the existing streaming pipeline path. The revert is synchronized with current `upstream/main` (`2c9608dd45960126ff3a91fc3bbb0addd53d816d`). Later overlapping fixes matrixorigin#26357 and matrixorigin#26393 remain present. There is no SQL syntax, protobuf, public API, or persistence-format change. ### Validation Exact head `fb1b16f27b9665203197678f385815755b143b06`: - previous head `d693b810af44d4d9f0ae22ad3b18d68e78e6dc06`: all major functional CI jobs passed; Matrixone Utils Coverage alone failed because modified-line coverage was exactly 75%, while the gate requires strictly greater than 75% - added `TestDispatchResetSkipsInvalidRemoteReceiversAndNotifiesHealthyPeer`, covering both nil receiver and nil error-channel guards while proving that a later healthy receiver still receives the original terminal error - focused coverprofile: `pkg/sql/colexec/dispatch/types.go:227.33,234.14` changed from count 0 in CI to count 1 locally - exact-head remote Coverage: PASS with 4/4 modified lines covered (`pr_coverage=1.0`, threshold `>0.75`) - affected planner/compile/dispatch/merge package tests: PASS - complete affected owning packages under `-race -count=1`: PASS - focused dispatch terminal and compile sink-scan tests under `-race -count=20`: PASS - affected package build and vet: PASS - `git diff --check`: PASS - exact reverse/overlap audit: only later matrixorigin#26357 and matrixorigin#26393 edits remain relative to the matrixorigin#26331 parent - schema-v4 preflight: `PASS review=PASS validation=PASS` BVT: the previous exact-head Proxy multi-CN and pessimistic BVT jobs passed. This follow-up adds package-internal unit coverage only and does not change product behavior. ### QA decision QA required: yes. This rolls back optimizer selection and the materialized fan-out execution path. CI and environment-level analytical-query regression coverage should complete before merge. Approved by: @XuPeng-SH
What changed
dedupjoinfinalization instead of reporting a successful end-of-streamWhy
The old
nilmessage protocol represented context cancellation, channel close, and normal abort with the same value. The merger consequently swallowed cancellation and could silently omit finalize output. It also made failure cleanup and capture ownership ambiguous.The new protocol carries an explicit abort/error status. Sender publication never waits, merger receive remains context-cancellable, and abort/error paths stop immediately without waiting for missing workers.
Tests
pkg/sql/colexec/dedupjoinpackagepkg/sql/colexec/dedupjoinpackage under-race-race -count=100pkg/sql/compilemailbox-generation duplication testgo vetforpkg/sql/colexec/dedupjoinandpkg/sql/compileAll new unhappy-path tests complete in milliseconds; no sleeps, retries, external services, or full-suite stress loops are used.
Fixes #26375