-
Notifications
You must be signed in to change notification settings - Fork 288
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- Hardware parameters:
- OS type: Linux
- Others:
- repository: matrixorigin/matrixone
- area: pkg/sql/colexec/dispatch
Actual Behavior
sendToAnyFunc() can swallow real send errors from sendToAnyLocalFunc() or sendToAnyRemoteFunc() by returning (false, nil) instead of propagating the error. That turns a failed dispatch into a success-shaped result, so upper layers can continue as if the batch had been sent successfully.
The risk is silent partial success / silent data loss rather than an explicit query failure.
Expected Behavior
When a local or remote sendToAny* helper returns a real error, sendToAnyFunc() should propagate that error to the caller immediately. Only the "all receivers of this kind are closed, fallback to the other kind" case should continue without error.
Steps to Reproduce
1. Use the current `main` code path in `pkg/sql/colexec/dispatch/sendfunc.go`.
2. Call `sendToAnyFunc()` in a state where it chooses the local branch.
3. Make `sendToAnyLocalFunc()` return `(false, someError)`.
4. Observe that `sendToAnyFunc()` returns `(false, nil)` instead of `someError`.
5. The same issue exists on the remote branch when `sendToAnyRemoteFunc()` returns a real error.A minimal regression test can be written at the unit-test level by stubbing the local/remote helpers and asserting the error is preserved.
Additional information
Relevant code before the fix:
pkg/sql/colexec/dispatch/sendfunc.go:346-349pkg/sql/colexec/dispatch/sendfunc.go:355-358
This area is particularly risky because sendToAny is the tolerant/failover path. It should tolerate exhausted receivers, but it should not mask genuine send failures such as network/write errors.