You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/22 11:12:09 UTC

[GitHub] [pulsar] Jason918 commented on a change in pull request #14411: [Broker] Remove dead brokers timeaverage data

Jason918 commented on a change in pull request #14411:
URL: https://github.com/apache/pulsar/pull/14411#discussion_r811830329



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
##########
@@ -482,6 +486,15 @@ public void updateAll() {
     // there by each broker via updateLocalBrokerData.
     private void updateAllBrokerData() {
         final Set<String> activeBrokers = getAvailableBrokers();
+        Collection<String> newBookies = CollectionUtils.subtract(activeBrokers, knownBrokers);

Review comment:
       ```suggestion
           Collection<String> newBrokers = CollectionUtils.subtract(activeBrokers, knownBrokers);
   ```

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
##########
@@ -482,6 +486,15 @@ public void updateAll() {
     // there by each broker via updateLocalBrokerData.
     private void updateAllBrokerData() {
         final Set<String> activeBrokers = getAvailableBrokers();
+        Collection<String> newBookies = CollectionUtils.subtract(activeBrokers, knownBrokers);
+        knownBrokers.addAll(newBookies);
+        Collection<String> deadBrokers = CollectionUtils.subtract(knownBrokers, activeBrokers);
+        knownBrokers.removeAll(deadBrokers);
+        for (String broker: deadBrokers) {
+            final String timeAverageZPath = TIME_AVERAGE_BROKER_ZPATH + "/" + broker;
+            timeAverageBrokerDataCache.delete(timeAverageZPath).join();

Review comment:
       Does this throw exception if path does not exists?




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

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