Akanksha-kedia opened a new pull request, #18777: URL: https://github.com/apache/pinot/pull/18777
## Description `HelixAdmin.getResourceIdealState()` can return `null` in two methods within tenant-deletability checks: ### `isBrokerTenantDeletable` The broker resource IdealState is fetched using `BROKER_RESOURCE_INSTANCE`. During cluster initialization or in edge cases (e.g., cluster not fully set up), this can be `null`. The previous code called `brokerIdealState.getPartitionSet()` directly, which would throw a `NullPointerException`. ### `isServerTenantDeletable` The method iterates over all resources via `getAllResources()` and then fetches each resource's IdealState. There is a TOCTOU race: a table resource can be concurrently deleted between `getAllResources()` and `getResourceIdealState()`, returning `null`. The previous code called `tableIdealState.getPartitionSet()` directly, which would throw a `NullPointerException`. ## Fix - **`isBrokerTenantDeletable`**: Guard null `brokerIdealState` by returning `true` (safe default — no broker resource means no brokers are assigned to this tenant) - **`isServerTenantDeletable`**: Guard null `tableIdealState` with `continue` (consistent with how concurrent deletions are handled elsewhere in the codebase — see `getServerToSegmentsMap`, `getServers`) ## Tests No functional behavior change for the normal (non-null) path. The null guards are defensive fixes for edge cases during cluster state transitions. ## Checklist - [x] No new public APIs without documentation - [x] Backward compatible change - [x] Code follows existing patterns in the codebase -- 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]
