Repository navigation
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? |
LeftHandCold
left a comment
There was a problem hiding this comment.
Reviewed head 8ff7e4f. No blocking issues found. The zero-batch remote path reuses the existing receiver-registration barrier and preserves the Call/Reset lifecycle: Call only waits for attachment, while terminal delivery remains in Reset. Cancellation and the 30s bound continue through the existing paths, and the regression tests cover both the direct empty-input case and the retry-before-registration interleaving.
Local validation:
- full pkg/sql/colexec/dispatch test suite
- the end-to-end compile regression test, 10 consecutive runs
- race runs for all three added regression tests
- git diff --check
## 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#25687 ## What this PR does / why we need it: A remote dispatch currently waits for receiver attachment only when a data batch reaches its send function. If the child produces no batches, Dispatch.Call returns ExecStop immediately. An early RemoteDispatchNotRegistered response can then outlive the producer: cleanup removes the newly published UUID before the client's 200 ms retry, and all later retries fail until the 30-second timeout. This PR restores the remote-dispatch lifecycle invariant at the producer boundary: successful terminal completion waits for all remote receivers even when the input is empty. It reuses the existing receiver barrier, context cancellation, and 30-second upper bound. The production change is intentionally limited to the zero-batch remote path: - non-empty dispatch is unchanged; - local-only dispatch is unchanged; - an already attached empty dispatch adds only two boolean checks; - a racing registration waits for the existing notify retry instead of failing after 30 seconds; - cancellation and unreachable receivers return through the existing bounded error paths; - no protocol, lock, goroutine, retry interval, or retained state is added. The regression tests cover direct empty-input attachment, cancellation-cause propagation, and the exact end-to-end interleaving where the first notify misses registration, the producer registers and becomes empty, and the retry must attach before terminal cleanup. The direct test was also run with the production fix removed and failed immediately, proving that it detects the original bug. ## Testing - make -j12 - make dev-build - go test ./pkg/sql/colexec/dispatch - go test ./pkg/sql/compile - go test -race for the empty-dispatch tests - go test -race for TestRemoteNotifyRetryAttachesToEmptyDispatchBeforeCompletion - go vet ./pkg/sql/colexec/dispatch ./pkg/sql/compile - go vet with molint for both affected packages - golangci-lint run -c .golangci.yml ./pkg/sql/colexec/dispatch ./pkg/sql/compile - Multi-CN Docker reproduction with 5M, 4M, and 1M-row tables: expected result 499999 - concurrency 8: 200/200 passed; unfixed code failed 4/200 - concurrency 16: 100/100 passed
## 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#25687 ## What this PR does / why we need it: A remote dispatch currently waits for receiver attachment only when a data batch reaches its send function. If the child produces no batches, Dispatch.Call returns ExecStop immediately. An early RemoteDispatchNotRegistered response can then outlive the producer: cleanup removes the newly published UUID before the client's 200 ms retry, and all later retries fail until the 30-second timeout. This PR restores the remote-dispatch lifecycle invariant at the producer boundary: successful terminal completion waits for all remote receivers even when the input is empty. It reuses the existing receiver barrier, context cancellation, and 30-second upper bound. The production change is intentionally limited to the zero-batch remote path: - non-empty dispatch is unchanged; - local-only dispatch is unchanged; - an already attached empty dispatch adds only two boolean checks; - a racing registration waits for the existing notify retry instead of failing after 30 seconds; - cancellation and unreachable receivers return through the existing bounded error paths; - no protocol, lock, goroutine, retry interval, or retained state is added. The regression tests cover direct empty-input attachment, cancellation-cause propagation, and the exact end-to-end interleaving where the first notify misses registration, the producer registers and becomes empty, and the retry must attach before terminal cleanup. The direct test was also run with the production fix removed and failed immediately, proving that it detects the original bug. ## Testing - make -j12 - make dev-build - go test ./pkg/sql/colexec/dispatch - go test ./pkg/sql/compile - go test -race for the empty-dispatch tests - go test -race for TestRemoteNotifyRetryAttachesToEmptyDispatchBeforeCompletion - go vet ./pkg/sql/colexec/dispatch ./pkg/sql/compile - go vet with molint for both affected packages - golangci-lint run -c .golangci.yml ./pkg/sql/colexec/dispatch ./pkg/sql/compile - Multi-CN Docker reproduction with 5M, 4M, and 1M-row tables: expected result 499999 - concurrency 8: 200/200 passed; unfixed code failed 4/200 - concurrency 16: 100/100 passed
## 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#25687 ## What this PR does / why we need it: A remote dispatch currently waits for receiver attachment only when a data batch reaches its send function. If the child produces no batches, Dispatch.Call returns ExecStop immediately. An early RemoteDispatchNotRegistered response can then outlive the producer: cleanup removes the newly published UUID before the client's 200 ms retry, and all later retries fail until the 30-second timeout. This PR restores the remote-dispatch lifecycle invariant at the producer boundary: successful terminal completion waits for all remote receivers even when the input is empty. It reuses the existing receiver barrier, context cancellation, and 30-second upper bound. The production change is intentionally limited to the zero-batch remote path: - non-empty dispatch is unchanged; - local-only dispatch is unchanged; - an already attached empty dispatch adds only two boolean checks; - a racing registration waits for the existing notify retry instead of failing after 30 seconds; - cancellation and unreachable receivers return through the existing bounded error paths; - no protocol, lock, goroutine, retry interval, or retained state is added. The regression tests cover direct empty-input attachment, cancellation-cause propagation, and the exact end-to-end interleaving where the first notify misses registration, the producer registers and becomes empty, and the retry must attach before terminal cleanup. The direct test was also run with the production fix removed and failed immediately, proving that it detects the original bug. ## Testing - make -j12 - make dev-build - go test ./pkg/sql/colexec/dispatch - go test ./pkg/sql/compile - go test -race for the empty-dispatch tests - go test -race for TestRemoteNotifyRetryAttachesToEmptyDispatchBeforeCompletion - go vet ./pkg/sql/colexec/dispatch ./pkg/sql/compile - go vet with molint for both affected packages - golangci-lint run -c .golangci.yml ./pkg/sql/colexec/dispatch ./pkg/sql/compile - Multi-CN Docker reproduction with 5M, 4M, and 1M-row tables: expected result 499999 - concurrency 8: 200/200 passed; unfixed code failed 4/200 - concurrency 16: 100/100 passed
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25687
What this PR does / why we need it:
A remote dispatch currently waits for receiver attachment only when a data batch reaches its send function. If the child produces no batches, Dispatch.Call returns ExecStop immediately. An early RemoteDispatchNotRegistered response can then outlive the producer: cleanup removes the newly published UUID before the client's 200 ms retry, and all later retries fail until the 30-second timeout.
This PR restores the remote-dispatch lifecycle invariant at the producer boundary: successful terminal completion waits for all remote receivers even when the input is empty. It reuses the existing receiver barrier, context cancellation, and 30-second upper bound.
The production change is intentionally limited to the zero-batch remote path:
The regression tests cover direct empty-input attachment, cancellation-cause propagation, and the exact end-to-end interleaving where the first notify misses registration, the producer registers and becomes empty, and the retry must attach before terminal cleanup. The direct test was also run with the production fix removed and failed immediately, proving that it detects the original bug.
Testing