lifepuzzlefun commented on code in PR #20512:
URL: https://github.com/apache/pulsar/pull/20512#discussion_r1225001795


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -603,6 +602,26 @@ private void updateBundleData() {
                 
LoadManagerShared.fillNamespaceToBundlesMap(preallocatedBundleData.keySet(), 
namespaceToBundleRange);
             }
         }
+
+        // Remove not active bundle from loadData
+        for (String bundle : bundleData.keySet()) {
+            if (!activeBundles.contains(bundle)) {
+                long notActiveTimes = notActiveBundleCounter
+                        .computeIfAbsent(bundle, k -> new 
AtomicLong()).incrementAndGet();
+
+                if (notActiveTimes > nonActiveBundleDeleteThreshold) {

Review Comment:
   > Do we know what causes inconsistency between `activeBundles` and 
`bundleData.keySet()`?
   
   Yes, the bundleData is upload to metadataStore by `LoadReportUpdaterTask` 
which will upload broker load data and bundle data. 
   
   This task will be execute every 5 seconds by default and also need meets the 
`ModularLoadManagerImpl.needBrokerDataUpdate` condition.
   
   And the broker local bundle data is only update by 
`BrokerService.updateRates()` every 60 seconds.  
   
   So if one broker load the bundle but not update the bundleStats in time, 
   and the previous bundle owner update the bundleStats and triggered the 
`LoadReportUpdaterTask` to report its own load data. 
   
   The bundle data is missing in all broker load-data.



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

Reply via email to