thetumbled commented on code in PR #21085: URL: https://github.com/apache/pulsar/pull/21085#discussion_r1309531265
########## 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()); Review Comment: `org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl#writeBundleDataOnZooKeeper` is executed in single thread. https://github.com/apache/pulsar/blob/d099ac4fa2f217b9c5f0a5e660c83048e829c5d7/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L318-L319 But, the bundle-data may be updated in another thread, which may fail the sorting process. I will fix this problem. -- 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