thetumbled commented on code in PR #21085:
URL: https://github.com/apache/pulsar/pull/21085#discussion_r1310155909
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -1139,6 +1145,30 @@ public void writeBrokerDataOnZooKeeper(boolean force) {
}
}
+
+ /**
+ * sort bundles by load and select topK bundles for each broker.
+ * @return the number of bundles selected
+ */
+ private CompletableFuture<Integer> selectTopKBundle() {
+ CompletableFuture completableFuture = new CompletableFuture();
+
+ executors.execute(() -> {
+ // make the bundle-data update and sorting executed in single
thread
+ bundleArr.clear();
+ bundleArr.addAll(loadData.getBundleData().entrySet());
+
+ // select topK bundle for each broker, so select topK *
brokerCount bundle in total
+ int brokerCount = Math.max(1, loadData.getBrokerData().size());
+ int updateBundleCount = Math.min(pulsar.getConfiguration()
+ .getLoadBalancerMaxNumberOfBundlesInBundleLoadReport() *
brokerCount, bundleArr.size());
+
+ TopKBundles.partitionSort(bundleArr, updateBundleCount,
bundleDataComparator);
Review Comment:
In `ExtensibleLoadManager`, each broker will update topK bundle-data, so the
total bundle-data count is `brokerCount*topK`.
While in `ModularLoadManagerImpl`, only leader broker will update the
bundle-data.
I think that we should make their behavior consistent.
--
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]