Repository navigation
[4.2-dev] fix(pipeline): wake receivers from terminal edge state - #26228
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? |
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? |
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.
Deep-reviewed the terminal-edge wakeup protocol on 9c7d4b9. Done wakeups preserve queued Ch2 ordering, synchronize with in-flight fatal senders, and keep shared-edge and reflect-select bookkeeping correct. Focused race tests (20x), affected/dependent package tests, build, and vet all pass locally. The remaining Coverage check failure is an artifact-collection issue (missing compose BVT profile); the latest SCA, UT, and BVT checks pass.
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? |
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #26125 and #26202. Main forward-port of #26228, which carries the same logical fix for `4.2-dev`. ## What this PR does / why we need it: A fatal `PipelineEdge` terminal is recorded and closes `Done()` before all required terminal signals are enqueued into `Ch2`. When `Ch2` is backpressured, the typed terminal signal can remain partially or completely undelivered. `PipelineSignalReceiver` previously waited only on its user context and `Ch2`, so it could remain blocked after the edge was already terminal. That leaves `Merge`, `RemoteRun`, and ultimately `Compile.runOnce` waiting indefinitely. This change: - listens to each edge `Done()` channel in both the optimized 1–8 input selects and the `reflect.Select` path; - drains buffered `Ch2` signals before synthesizing a missing terminal from the durable edge state; - synchronizes and rechecks `Ch2` to preserve ordering across the fatal-state/enqueue race; - makes fatal terminal enqueue non-blocking while holding the terminal-state mutex, avoiding a control-path wait cycle behind the data channel; - adds regressions for buffered ordering, undelivered fatal terminals, shared edges, connector fallback cleanup, and reflect-select removal/reindexing across the 9-to-8 input transition. Normal `End` delivery and the legacy nil-batch compatibility path remain unchanged. The forward-port applies cleanly and is patch-equivalent to #26228. ## Validation - `make thirdparties && make cgo` - `go build ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `go vet ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - focused new regressions with `-race -count=20` - `go test -race -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connector` - `go test -count=1 -timeout=600s ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `git diff --check` --------- Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…origin#26250) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26125 and matrixorigin#26202. Main forward-port of matrixorigin#26228, which carries the same logical fix for `4.2-dev`. ## What this PR does / why we need it: A fatal `PipelineEdge` terminal is recorded and closes `Done()` before all required terminal signals are enqueued into `Ch2`. When `Ch2` is backpressured, the typed terminal signal can remain partially or completely undelivered. `PipelineSignalReceiver` previously waited only on its user context and `Ch2`, so it could remain blocked after the edge was already terminal. That leaves `Merge`, `RemoteRun`, and ultimately `Compile.runOnce` waiting indefinitely. This change: - listens to each edge `Done()` channel in both the optimized 1–8 input selects and the `reflect.Select` path; - drains buffered `Ch2` signals before synthesizing a missing terminal from the durable edge state; - synchronizes and rechecks `Ch2` to preserve ordering across the fatal-state/enqueue race; - makes fatal terminal enqueue non-blocking while holding the terminal-state mutex, avoiding a control-path wait cycle behind the data channel; - adds regressions for buffered ordering, undelivered fatal terminals, shared edges, connector fallback cleanup, and reflect-select removal/reindexing across the 9-to-8 input transition. Normal `End` delivery and the legacy nil-batch compatibility path remain unchanged. The forward-port applies cleanly and is patch-equivalent to matrixorigin#26228. ## Validation - `make thirdparties && make cgo` - `go build ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `go vet ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - focused new regressions with `-race -count=20` - `go test -race -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connector` - `go test -count=1 -timeout=600s ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `git diff --check` --------- Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…origin#26250) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26125 and matrixorigin#26202. Main forward-port of matrixorigin#26228, which carries the same logical fix for `4.2-dev`. ## What this PR does / why we need it: A fatal `PipelineEdge` terminal is recorded and closes `Done()` before all required terminal signals are enqueued into `Ch2`. When `Ch2` is backpressured, the typed terminal signal can remain partially or completely undelivered. `PipelineSignalReceiver` previously waited only on its user context and `Ch2`, so it could remain blocked after the edge was already terminal. That leaves `Merge`, `RemoteRun`, and ultimately `Compile.runOnce` waiting indefinitely. This change: - listens to each edge `Done()` channel in both the optimized 1–8 input selects and the `reflect.Select` path; - drains buffered `Ch2` signals before synthesizing a missing terminal from the durable edge state; - synchronizes and rechecks `Ch2` to preserve ordering across the fatal-state/enqueue race; - makes fatal terminal enqueue non-blocking while holding the terminal-state mutex, avoiding a control-path wait cycle behind the data channel; - adds regressions for buffered ordering, undelivered fatal terminals, shared edges, connector fallback cleanup, and reflect-select removal/reindexing across the 9-to-8 input transition. Normal `End` delivery and the legacy nil-batch compatibility path remain unchanged. The forward-port applies cleanly and is patch-equivalent to matrixorigin#26228. ## Validation - `make thirdparties && make cgo` - `go build ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `go vet ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - focused new regressions with `-race -count=20` - `go test -race -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connector` - `go test -count=1 -timeout=600s ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `git diff --check` --------- Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…origin#26250) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26125 and matrixorigin#26202. Main forward-port of matrixorigin#26228, which carries the same logical fix for `4.2-dev`. ## What this PR does / why we need it: A fatal `PipelineEdge` terminal is recorded and closes `Done()` before all required terminal signals are enqueued into `Ch2`. When `Ch2` is backpressured, the typed terminal signal can remain partially or completely undelivered. `PipelineSignalReceiver` previously waited only on its user context and `Ch2`, so it could remain blocked after the edge was already terminal. That leaves `Merge`, `RemoteRun`, and ultimately `Compile.runOnce` waiting indefinitely. This change: - listens to each edge `Done()` channel in both the optimized 1–8 input selects and the `reflect.Select` path; - drains buffered `Ch2` signals before synthesizing a missing terminal from the durable edge state; - synchronizes and rechecks `Ch2` to preserve ordering across the fatal-state/enqueue race; - makes fatal terminal enqueue non-blocking while holding the terminal-state mutex, avoiding a control-path wait cycle behind the data channel; - adds regressions for buffered ordering, undelivered fatal terminals, shared edges, connector fallback cleanup, and reflect-select removal/reindexing across the 9-to-8 input transition. Normal `End` delivery and the legacy nil-batch compatibility path remain unchanged. The forward-port applies cleanly and is patch-equivalent to matrixorigin#26228. ## Validation - `make thirdparties && make cgo` - `go build ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `go vet ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - focused new regressions with `-race -count=20` - `go test -race -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connector` - `go test -count=1 -timeout=600s ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch` - `git diff --check` --------- Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26202 and #26125.
This PR targets
4.2-devfor #26202. The same logical change needs to be forward-ported tomainfor the #26125 reproduction.What this PR does / why we need it:
A fatal
PipelineEdgeterminal is recorded and closesDone()before all required terminal signals are enqueued intoCh2. WhenCh2is backpressured, the typed terminal signal can remain partially or completely undelivered.PipelineSignalReceiverpreviously waited only on its user context andCh2, so it could remain blocked after the edge was already terminal. That leavesMerge,RemoteRun, and ultimatelyCompile.runOncewaiting indefinitely.This change:
Done()channel in both the optimized 1–8 input selects and thereflect.Selectpath;Ch2signals before synthesizing a missing terminal from the durable edge state;Ch2to preserve ordering across the fatal-state/enqueue race;Normal
Enddelivery and the legacy nil-batch compatibility path remain unchanged.Validation
go build ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatchgo vet ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatch-race -count=20go test -race -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connectorgo test -count=1 -timeout=600s ./pkg/vm/process ./pkg/sql/colexec/connectorgo test -count=1 -timeout=600s ./pkg/sql/colexec/merge ./pkg/sql/colexec/dispatchgit diff --check