merlimat commented on a change in pull request #10391:
URL: https://github.com/apache/pulsar/pull/10391#discussion_r623381564
##########
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:
Yes, we can add the timeouts in the `AbstractMetadataStoreImpl`.
Otherwise we only have timeouts for sync calls, but in most places we're doing
(and we should do more) the async calls.
--
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]