rdhabalia commented on a change in pull request #10391:
URL: https://github.com/apache/pulsar/pull/10391#discussion_r623333854



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
##########
@@ -363,24 +343,27 @@ private void reapDeadBrokerPreallocations(Set<String> 
aliveBrokers) {
     @Override
     public Set<String> getAvailableBrokers() {
         try {
-            return availableActiveBrokers.get();
+            return new 
TreeSet<>(brokersData.listLocks(LoadManager.LOADBALANCE_BROKERS_ROOT).join());
         } catch (Exception e) {
             log.warn("Error when trying to get active brokers", e);
             return loadData.getBrokerData().keySet();
         }
     }
 
-    // Attempt to local the data for the given bundle in ZooKeeper.
+    // Attempt to local the data for the given bundle in metadata store
     // If it cannot be found, return the default bundle data.
     private BundleData getBundleDataOrDefault(final String bundle) {
         BundleData bundleData = null;
         try {
-            final String bundleZPath = getBundleDataZooKeeperPath(bundle);
-            final String quotaZPath = String.format("%s/%s", 
RESOURCE_QUOTA_ZPATH, bundle);
-            if (zkClient.exists(bundleZPath, null) != null) {
-                bundleData = readJson(zkClient.getData(bundleZPath, null, 
null), BundleData.class);
-            } else if (zkClient.exists(quotaZPath, null) != null) {
-                final ResourceQuota quota = 
readJson(zkClient.getData(quotaZPath, null, null), ResourceQuota.class);
+            Optional<BundleData> optBundleData = 
bundlesCache.get(getBundleDataPath(bundle)).join();

Review comment:
       umm.. you mean it will be  metadata store-impl's responsibility to 
complete the returned CompletableFuture in certain time? ZK-Impl depends on 
ZK-Client and returns future. So, if we put timeout responsibility to impl 
class then Impl has to add extra handling to return time based future. this 
doesn't seem feasible solution. 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to