Akanksha-kedia opened a new pull request, #18697:
URL: https://github.com/apache/pinot/pull/18697
## Description
`DebugResource.debugBrokers()` fetches the broker resource ideal-state and
external-view via `HelixDataAccessor.getProperty()`. Both calls can
legitimately return `null` (e.g. during cluster initialisation or a controller
leader transition), and `ExternalView.getStateMap()` itself can return `null`
for a partition not yet tracked in the external-view.
The current code dereferences all three without null-checks, producing a
`NullPointerException` on the `/debug/tables/{tableName}` endpoint in those
transient states.
**Three NPE paths in `debugBrokers()`:**
1. `idealState.getInstanceStateMap(tableNameWithType)` — `idealState` may be
`null`
2. `externalView.getStateMap(tableNameWithType)` — `externalView` may be
`null`
3. `.get(brokerName)` on the result of `getStateMap()` — that map may itself
be `null`
**Fix:** guard all three call-sites and return an empty list when the
ideal-state map is absent; treat a missing EV partition as a `null` `evState` —
consistent with how `debugServers` already handles the same scenario (lines
357–358 of the same file).
## Related Issues / PRs
Follows the same pattern as #18455 (_Fix NPE in
`HelixHelper.getOfflineInstanceFromExternalView` when `resourceExternalView` is
null_).
## Checklist
- [x] No behaviour change on the happy path
- [x] Null-handling is consistent with the existing pattern in `debugServers`
--
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]