Fix potential NPE in PinotHelixResourceManager tenant deletability checks#18777
Merged
Jackie-Jiang merged 1 commit intoJun 21, 2026
Conversation
…ecks getResourceIdealState() can return null when the broker resource has not been initialized yet or when a table resource is concurrently deleted between getAllResources() and getResourceIdealState(). - isBrokerTenantDeletable: guard against null brokerIdealState by returning true (safe: no broker assignments means tenant is deletable) - isServerTenantDeletable: skip null tableIdealState entries arising from a race between resource enumeration and concurrent table deletion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18777 +/- ##
=========================================
Coverage 64.78% 64.79%
Complexity 1309 1309
=========================================
Files 3380 3380
Lines 209540 209544 +4
Branches 32797 32799 +2
=========================================
+ Hits 135751 135774 +23
+ Misses 62863 62847 -16
+ Partials 10926 10923 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@xiangfu0 @Jackie-Jiang all CI checks pass, review comments addressed. Please review when you get a chance. |
Jackie-Jiang
approved these changes
Jun 21, 2026
cypherean
pushed a commit
to cypherean/pinot
that referenced
this pull request
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
HelixAdmin.getResourceIdealState()can returnnullin two methods within tenant-deletability checks:isBrokerTenantDeletableThe 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 benull. The previous code calledbrokerIdealState.getPartitionSet()directly, which would throw aNullPointerException.isServerTenantDeletableThe 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 betweengetAllResources()andgetResourceIdealState(), returningnull. The previous code calledtableIdealState.getPartitionSet()directly, which would throw aNullPointerException.Fix
isBrokerTenantDeletable: Guard nullbrokerIdealStateby returningtrue(safe default — no broker resource means no brokers are assigned to this tenant)isServerTenantDeletable: Guard nulltableIdealStatewithcontinue(consistent with how concurrent deletions are handled elsewhere in the codebase — seegetServerToSegmentsMap,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