Repository navigation
fix: acknowledge remote batches before early stop - #26751
mergify[bot] merged 2 commits into
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head dc8f769f56ff5e314f4e62e53259f8e61d755200.
No blocking findings remain.
The fix restores the remote-batch credit invariant at the correct boundary: once a decoded batch has either been handed to the local pipeline or intentionally discarded because that receiver is terminal, the client must release the corresponding remote credit before a graceful early return. Connector, dispatch, and remote-notify now all do so.
The ownership and termination paths remain separated correctly:
- Normal forwarding transfers local batch cleanup to the downstream edge, then ACKs the remote serialized-batch credit.
- A terminal receiver rejects the handoff;
forwardRemoteBatchWithContext/dispatch cleans the decoded batch locally, then the new ACK releases the server-side credit before returning. - Decode, execution, cancellation, and ACK-send failures still return errors without clearing
pendingBatchAck; stream/query teardown remains the failure owner rather than falsely acknowledging success. - The ACK is cumulative/idempotent on the server, and the client still prevents receiving another logical batch while one ACK is pending, so this change does not weaken the negotiated count/byte bounds.
Q1/Q2/Q3 audit: every decoded batch has exactly one local cleanup owner; the server drain wait now terminates on graceful early stop while error/cancel retains its independent connection/context termination; outstanding batch count and bytes remain bounded by the negotiated flow-control limits.
Independent differential validation reproduced pendingBatchAck == 7 on exact base ffc16032b7ab79a4fa97dba6e5bb57cf9ef5ed8a; the same receiver-terminal shape sends the matching ACK and clears the credit on this head. I also added temporary adjacent counterexamples proving across 25 race iterations that cancellation sends no success ACK and an ACK transport failure is still returned as an error.
Local exact-head validation passed: the three committed regressions under -race -count=25, full pkg/sql/compile tests, dependent connector/dispatch tests, go build, go vet, and git diff --check. Current GitHub CI is complete with no failures.
Merge Queue Status
This pull request spent 3 hours 35 minutes 2 seconds in the queue, including 39 minutes 56 seconds running CI. Required conditions to merge
|
Remote batch backpressure records a batch as outstanding until the client sends its ACK. The connector, dispatch, and remote-notify receive loops returned before that ACK when downstream had already stopped, leaving the server drain barrier to wait for its 30-second timeout. This change acknowledges a successfully decoded batch after it is handed off or intentionally discarded, before a graceful early return. Error and cancellation paths still return without a success ACK and rely on stream teardown, preserving the bounded-credit behavior introduced by matrixorigin#26711. It also adds regression coverage for all three graceful-stop paths. Tests: - `go test -race -count=25` for each new/updated regression test - `go test -race -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch` - `go list`, `go build`, and `go vet` for `./pkg/sql/compile` Approved by: @XuPeng-SH
Remote batch backpressure records a batch as outstanding until the client sends its ACK. The connector, dispatch, and remote-notify receive loops returned before that ACK when downstream had already stopped, leaving the server drain barrier to wait for its 30-second timeout. This change acknowledges a successfully decoded batch after it is handed off or intentionally discarded, before a graceful early return. Error and cancellation paths still return without a success ACK and rely on stream teardown, preserving the bounded-credit behavior introduced by matrixorigin#26711. It also adds regression coverage for all three graceful-stop paths. Tests: - `go test -race -count=25` for each new/updated regression test - `go test -race -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch` - `go list`, `go build`, and `go vet` for `./pkg/sql/compile` Approved by: @XuPeng-SH
Remote batch backpressure records a batch as outstanding until the client sends its ACK. The connector, dispatch, and remote-notify receive loops returned before that ACK when downstream had already stopped, leaving the server drain barrier to wait for its 30-second timeout. This change acknowledges a successfully decoded batch after it is handed off or intentionally discarded, before a graceful early return. Error and cancellation paths still return without a success ACK and rely on stream teardown, preserving the bounded-credit behavior introduced by matrixorigin#26711. It also adds regression coverage for all three graceful-stop paths. Tests: - `go test -race -count=25` for each new/updated regression test - `go test -race -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/compile` - `go test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch` - `go list`, `go build`, and `go vet` for `./pkg/sql/compile` Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
issue #26746
What this PR does / why we need it:
Remote batch backpressure records a batch as outstanding until the client sends its ACK. The connector, dispatch, and remote-notify receive loops returned before that ACK when downstream had already stopped, leaving the server drain barrier to wait for its 30-second timeout.
This change acknowledges a successfully decoded batch after it is handed off or intentionally discarded, before a graceful early return. Error and cancellation paths still return without a success ACK and rely on stream teardown, preserving the bounded-credit behavior introduced by #26711.
It also adds regression coverage for all three graceful-stop paths.
Tests:
go test -race -count=25for each new/updated regression testgo test -race -count=1 ./pkg/sql/compilego test -count=1 ./pkg/sql/compilego test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatchgo list,go build, andgo vetfor./pkg/sql/compile