lhotari commented on code in PR #4652:
URL: https://github.com/apache/bookkeeper/pull/4652#discussion_r2428772058


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java:
##########
@@ -366,14 +366,14 @@ protected Set<BookieId> 
addDefaultRackBookiesIfMinNumRacksIsEnforced(
             for (Node node : defaultRackLeaves) {
                 if (node instanceof BookieNode) {
                     if (bookiesInDefaultRack == null) {
-                        bookiesInDefaultRack = new 
HashSet<BookieId>(excludeBookies);
+                        bookiesInDefaultRack = new HashSet<>();
                     }
                     bookiesInDefaultRack.add(((BookieNode) node).getAddr());
                 } else {
                     LOG.error("found non-BookieNode: {} as leaf of 
defaultrack: {}", node, getDefaultRack());
                 }
             }
-            if ((bookiesInDefaultRack == null) || 
bookiesInDefaultRack.isEmpty()) {
+            if (bookiesInDefaultRack == null) {
                 comprehensiveExclusionBookiesSet = excludeBookies;
             } else {
                 comprehensiveExclusionBookiesSet = new 
HashSet<BookieId>(excludeBookies);

Review Comment:
   it seems that it would be better to always initialize this to `new 
HashSet<>(excludeBookies)` in the first line of this method. The logic doesn't 
make much sense any more.



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