yashmayya opened a new pull request, #20440:
URL: https://github.com/apache/pinot/pull/20440

   ## Problem
   
   With stream stats on (`streamStats=true`), the broker cancels every opchain 
as soon as one opchain reports a failure. Each server then ends its opchains 
with `QUERY_CANCELLATION` ("Cancelled on: <server>"). These cancellation errors 
race the real error through the mailboxes, and stage 0 keeps the first error it 
gets.
   
   When the real error waits behind a blocking operator, a cancellation usually 
reaches stage 0 first. For example, a hash join that is still building from its 
other input does not read the error yet. The client then sees `503 ... 
Cancelled on: Server_X` instead of the error that caused the cancel.
   
   ## Fix
   
   - `OpChainComplete` gets an `error_code` field (6). The server sets it from 
the opchain's `QueryErrorCode`.
   - `StreamingQuerySession` keeps the opchain failure that triggered the 
fan-out cancel.
   - If the query result is a `QUERY_CANCELLATION`, `QueryDispatcher` reports 
that failure instead. It keeps the cancellation when the failure is itself a 
cancellation, or when the server sent no error code.
   - The opchain error message no longer includes the stats dump, because the 
client can now see it. The failure log still prints the stats. The structured 
stats in `OpChainComplete.stats` do not change.
   
   Mixed versions: an older server sends no `error_code`, so the broker keeps 
the old behavior. An older broker ignores the new field.
   
   ## Validation
   
   - New 
`StreamStatsReportingIntegrationTest#testFailureIsNotHiddenByFanOutCancel`. On 
the old code it fails with `503 ... Cancelled on: Server_...`; with the fix the 
class passes (8/8).
   - New unit tests in `StreamingQuerySessionTest`, 
`StreamingDispatchObserverTest`, `QueryDispatcherTest` and 
`OpChainSchedulerServiceTest` (127 tests pass across these classes).
   - A downstream 3-server repro, with the failing aggregate on the probe side 
of a join at `stageParallelism=4`, showed the cancellation in 39 of 40 runs 
before the fix. With the fix, it showed the real error in 20 of 20 runs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to