J-HowHuang commented on code in PR #15368:
URL: https://github.com/apache/pinot/pull/15368#discussion_r2019866239


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancer.java:
##########
@@ -711,6 +750,15 @@ private RebalanceSummaryResult 
calculateDryRunSummary(Map<String, Map<String, St
       }
     }
 
+    if (existingServersToConsumingSegmentMap != null && 
newServersToConsumingSegmentMap != null) {
+      for (Map.Entry<String, Set<String>> entry : 
newServersToConsumingSegmentMap.entrySet()) {
+        String server = entry.getKey();
+        
entry.getValue().removeAll(existingServersToConsumingSegmentMap.getOrDefault(server,
 Collections.emptySet()));

Review Comment:
   ```
   newServersToConsumingSegmentMap.entrySet().removeIf(entry -> 
entry.getValue().isEmpty());
   ```
   This is outside of the loop you commented here. And the `entry.getValue()` 
at L824 has `entry` passed from the anonymous function.
   
   Loop at L820 is the different loop to L824. They cannot be in the same map 
traversal because the latter is removing entries from the map. That's why I 
brought up "And key removal from the map should be after the traversal here."
   



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to