Repository navigation
fix(pipeline): preserve JoinMap cancellation causes - #27648
Conversation
Keep context cancellation identity through JoinMap dependency publication so scope arbitration can return the causal execution failure instead of sibling cleanup fallout. Preserve substantive MatrixOne errors and add message, operator, and scope regression coverage.\n\nFixes #27646
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? |
LeftHandCold
left a comment
There was a problem hiding this comment.
Reviewed the full diff and the producer → JoinMap broadcast → all consumer operators → scope arbitration closure. Cancellation/deadline identity is preserved only for all-cancellation error trees; mixed substantive failures remain authoritative. No new ownership, wait-for, generation, or unbounded-growth edge was introduced. Fresh local validation passed: gofmt/diff-check, build, vet, full tests and full race tests for pkg/vm/message, pkg/sql/colexec/hashjoin, and pkg/sql/compile; all 7 changed/new focused tests also passed under -race -count=100. No blocking findings.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27646 ## What this PR does / why we need it: A multi-target INSERT can raise a real target-side error (for example, an invalid ENUM value) while canceling a sibling HashBuild pipeline. The JoinMap dependency used to convert that sibling `context.Canceled` into an ordinary internal `moerr`, so scope arbitration could no longer recognize it as cancellation fallout and could return `internal error: context canceled` instead of the causal execution error. This PR: - preserves wrapped and joined cancellation/deadline identity through JoinMap failure publication; - keeps substantive MatrixOne errors (OOM, storage errors, and similar failures) authoritative when mixed with cancellation; - propagates the preserved identity from both JoinMap receive paths so existing scope arbitration can select the causal error; - keeps `JoinMapResult.Err()` and stable `moerr` code/detail behavior compatible; - adds message-boundary, hash-join operator, cleanup/memory, and scope-arbitration regression tests. ### Performance The successful JoinMap path is unchanged. Cancellation-tree classification runs once only when a HashBuild publishes a terminal failure. No row/batch hot path, lock, goroutine, wait dependency, or unbounded state is added. ### Unhappy paths and risk - Pure cancellation, wrapped cancellation, deadline, and joined cancellation/deadline retain `errors.Is` identity. - Cancellation joined with OOM or a generic execution failure remains a substantive failure and is not downgraded to cleanup fallout. - A failed build stops before consuming or emitting probe rows and cleanup returns memory usage to zero. - The broadcast terminal-state and generation/ownership protocols are unchanged. - The existing multi-target INSERT BVT remains the end-to-end regression; this change fixes the lower-level error transport that made it nondeterministic. ### Validation - `go build -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go vet -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly -race ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - New cancellation/error-arbitration tests under `-race -count=100`
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27646 ## What this PR does / why we need it: A multi-target INSERT can raise a real target-side error (for example, an invalid ENUM value) while canceling a sibling HashBuild pipeline. The JoinMap dependency used to convert that sibling `context.Canceled` into an ordinary internal `moerr`, so scope arbitration could no longer recognize it as cancellation fallout and could return `internal error: context canceled` instead of the causal execution error. This PR: - preserves wrapped and joined cancellation/deadline identity through JoinMap failure publication; - keeps substantive MatrixOne errors (OOM, storage errors, and similar failures) authoritative when mixed with cancellation; - propagates the preserved identity from both JoinMap receive paths so existing scope arbitration can select the causal error; - keeps `JoinMapResult.Err()` and stable `moerr` code/detail behavior compatible; - adds message-boundary, hash-join operator, cleanup/memory, and scope-arbitration regression tests. ### Performance The successful JoinMap path is unchanged. Cancellation-tree classification runs once only when a HashBuild publishes a terminal failure. No row/batch hot path, lock, goroutine, wait dependency, or unbounded state is added. ### Unhappy paths and risk - Pure cancellation, wrapped cancellation, deadline, and joined cancellation/deadline retain `errors.Is` identity. - Cancellation joined with OOM or a generic execution failure remains a substantive failure and is not downgraded to cleanup fallout. - A failed build stops before consuming or emitting probe rows and cleanup returns memory usage to zero. - The broadcast terminal-state and generation/ownership protocols are unchanged. - The existing multi-target INSERT BVT remains the end-to-end regression; this change fixes the lower-level error transport that made it nondeterministic. ### Validation - `go build -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go vet -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly -race ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - New cancellation/error-arbitration tests under `-race -count=100`
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27646 ## What this PR does / why we need it: A multi-target INSERT can raise a real target-side error (for example, an invalid ENUM value) while canceling a sibling HashBuild pipeline. The JoinMap dependency used to convert that sibling `context.Canceled` into an ordinary internal `moerr`, so scope arbitration could no longer recognize it as cancellation fallout and could return `internal error: context canceled` instead of the causal execution error. This PR: - preserves wrapped and joined cancellation/deadline identity through JoinMap failure publication; - keeps substantive MatrixOne errors (OOM, storage errors, and similar failures) authoritative when mixed with cancellation; - propagates the preserved identity from both JoinMap receive paths so existing scope arbitration can select the causal error; - keeps `JoinMapResult.Err()` and stable `moerr` code/detail behavior compatible; - adds message-boundary, hash-join operator, cleanup/memory, and scope-arbitration regression tests. ### Performance The successful JoinMap path is unchanged. Cancellation-tree classification runs once only when a HashBuild publishes a terminal failure. No row/batch hot path, lock, goroutine, wait dependency, or unbounded state is added. ### Unhappy paths and risk - Pure cancellation, wrapped cancellation, deadline, and joined cancellation/deadline retain `errors.Is` identity. - Cancellation joined with OOM or a generic execution failure remains a substantive failure and is not downgraded to cleanup fallout. - A failed build stops before consuming or emitting probe rows and cleanup returns memory usage to zero. - The broadcast terminal-state and generation/ownership protocols are unchanged. - The existing multi-target INSERT BVT remains the end-to-end regression; this change fixes the lower-level error transport that made it nondeterministic. ### Validation - `go build -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go vet -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - `go test -mod=readonly -race ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile` - New cancellation/error-arbitration tests under `-race -count=100`
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27646
What this PR does / why we need it:
A multi-target INSERT can raise a real target-side error (for example, an invalid ENUM value) while canceling a sibling HashBuild pipeline. The JoinMap dependency used to convert that sibling
context.Canceledinto an ordinary internalmoerr, so scope arbitration could no longer recognize it as cancellation fallout and could returninternal error: context canceledinstead of the causal execution error.This PR:
JoinMapResult.Err()and stablemoerrcode/detail behavior compatible;Performance
The successful JoinMap path is unchanged. Cancellation-tree classification runs once only when a HashBuild publishes a terminal failure. No row/batch hot path, lock, goroutine, wait dependency, or unbounded state is added.
Unhappy paths and risk
errors.Isidentity.Validation
go build -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compilego vet -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compilego test -mod=readonly ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compilego test -mod=readonly -race ./pkg/vm/message ./pkg/sql/colexec/hashjoin ./pkg/sql/compile-race -count=100