[fix][bk] Fix NPE in IsolatedBookieEnsemblePlacementPolicy when policy class does not match#25825
Merged
dao-jun merged 2 commits intoMay 27, 2026
Conversation
…y class does not match MutablePair was initialized without default values, leaving left/right as null when the ensemble placement policy class name did not match. This caused a NullPointerException when getLeft().contains() was called. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
eb5e766 to
35f3158
Compare
void-ptr974
approved these changes
May 22, 2026
Contributor
void-ptr974
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing the fallback behavior.
dao-jun
approved these changes
May 22, 2026
Contributor
Author
|
/pulsarbot rerun-failure-checks |
Contributor
Author
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.
Fixes NPE in
IsolatedBookieEnsemblePlacementPolicyMotivation
A
NullPointerExceptionoccurs ingetExcludedBookiesWithIsolationGroupswhengetIsolationGroup()returns aPairwhoseleftvalue isnull. This happens when theEnsemblePlacementPolicyConfigcarries a policy class name that does not equalIsolatedBookieEnsemblePlacementPolicy— in that case theifblock that callspair.setLeft()/pair.setRight()is skipped entirely, leaving both sides of theMutablePairasnull.This bug was observed during the upgrade from the 2.8 branch to the 3.0 branch. The same defect may also exist in master.
Full stack trace from production:
This error causes topics to time out during loading. Since there is no automatic recovery path, the only way to restore service is by restarting the broker.
Modifications
Two complementary fixes:
getIsolationGroup(): Ensure not returning pair of null: add compatibility withZkIsolatedBookieEnsemblePlacementPolicyand fallback to defaultIsolationGroups if met a mis-match policy class.Verifying this change
This change added tests and can be verified as follows:
testReplaceBookieWithNonMatchingPolicyClassShouldNotThrowNPEto reproduce the exact production failure: callingreplaceBookiewith custom metadata whoseEnsemblePlacementPolicyConfigpolicy class does not matchIsolatedBookieEnsemblePlacementPolicy, which previously caused the NPE.Does this pull request potentially affect one of the following parts: