heesung-sn commented on code in PR #21085:
URL: https://github.com/apache/pulsar/pull/21085#discussion_r1309137447


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -1139,6 +1143,23 @@ public void writeBrokerDataOnZooKeeper(boolean force) {
         }
     }
 
+    /**
+     * sort bundles by load and select topK bundles for each broker.
+     * @return the number of bundles selected
+     */
+    private int selectTopKBundle() {
+        bundleArr.clear();
+
+        bundleArr.addAll(loadData.getBundleData().entrySet());
+        // select topK bundle for each broker, so select topK * brokerCount 
bundle in total
+        int brokerCount = loadData.getBrokerData().size();
+        int updateBundleCount = pulsar.getConfiguration()
+                .getLoadBalancerMaxNumberOfBundlesInBundleLoadReport() * 
brokerCount;

Review Comment:
   can brokerCount be 0?



-- 
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...@pulsar.apache.org

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

Reply via email to