void-ptr974 commented on code in PR #25825:
URL: https://github.com/apache/pulsar/pull/25825#discussion_r3271485201


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java:
##########
@@ -215,13 +218,7 @@ Set<BookieId> getExcludedBookiesWithIsolationGroups(int 
ensembleSize,
                     return excludedBookies;
                 }
                 int totalAvailableBookiesInPrimaryGroup = 0;
-                Set<String> primaryIsolationGroup = Collections.emptySet();
-                Set<String> secondaryIsolationGroup = Collections.emptySet();
                 Set<BookieId> primaryGroupBookies = new HashSet<>();
-                if (isolationGroups != null) {
-                    primaryIsolationGroup = isolationGroups.getLeft();
-                    secondaryIsolationGroup = isolationGroups.getRight();
-                }
                 for (String group : allGroups) {
                     Set<String> bookiesInGroup = 
allGroupsBookieMapping.get(group).keySet();
                     if (!primaryIsolationGroup.contains(group)) {

Review Comment:
   This is the problematic behavior for the non-matching policyClass case. 
After this PR, getIsolationGroup() returns empty primary/secondary groups when 
the metadata policyClass is not
   IsolatedBookieEnsemblePlacementPolicy. With primaryIsolationGroup empty, 
this condition is true for every configured group, so all grouped bookies are 
added to excludedBookies below. That avoids the NPE but can
   still make replaceBookie fail with BKNotEnoughBookiesException. A 
non-matching policyClass should be ignored or fall back to 
defaultIsolationGroups, not be treated as an empty isolation group.



-- 
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]

Reply via email to