Akanksha-kedia opened a new pull request, #18491:
URL: https://github.com/apache/pinot/pull/18491
## Description
Fix a `NullPointerException` in `StreamOp.fetchExistingTotalDocs` that
occurs when the broker response contains a non-empty `exceptions` array.
Fixes #18490
## Root Cause
The `exceptions` field in the broker query response is a JSON **array**
(`[{"errorCode": 410, ...}]`), but the code was calling
`exceptions.get("errorCode")` as if it were a JSON object. Jackson's
`ArrayNode.get(String)` always returns `null`, so the subsequent
`errorCode.asInt()` throws an NPE.
## Changes Made
1. **Fix array access**: Index into `exceptions.get(0)` first, then extract
`errorCode` from the first exception object
2. **Add null guards**: Defensively handle the case where the array element
or errorCode field is missing
3. **Handle BROKER_SEGMENT_UNAVAILABLE (305)**: Treat this as a transient
condition (segments still loading after a rolling upgrade) and return 0 to
allow the caller's retry loop to continue, consistent with the existing
`BROKER_INSTANCE_MISSING` handling
## Testing Done
- [x] `mvn spotless:check` passes for `pinot-compatibility-verifier`
- [x] Code review — the fix is minimal and follows the existing pattern in
the method
## Checklist
- [x] Code follows project style guidelines
- [x] Self-review completed
- [x] No new warnings introduced
- [x] Single-concern change (split from #18360 per reviewer feedback)
--
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]