lhotari commented on code in PR #19420:
URL: https://github.com/apache/pulsar/pull/19420#discussion_r1107067748


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -568,24 +570,19 @@ private void updateBundleData() {
 
             // Remove all loaded bundles from the preallocated maps.
             final Map<String, BundleData> preallocatedBundleData = 
brokerData.getPreallocatedBundleData();
+            Set<String> ownedNsBundles = 
pulsar.getNamespaceService().getOwnedServiceUnits()
+                    
.stream().map(NamespaceBundle::toString).collect(Collectors.toSet());
             synchronized (preallocatedBundleData) {
-                for (String preallocatedBundleName : 
brokerData.getPreallocatedBundleData().keySet()) {
-                    if 
(brokerData.getLocalData().getBundles().contains(preallocatedBundleName)) {
-                        final Iterator<Map.Entry<String, BundleData>> 
preallocatedIterator =
-                                preallocatedBundleData.entrySet()
-                                        .iterator();
-                        while (preallocatedIterator.hasNext()) {
-                            final String bundle = 
preallocatedIterator.next().getKey();
-
-                            if (bundleData.containsKey(bundle)) {
-                                preallocatedIterator.remove();
-                                preallocatedBundleToBroker.remove(bundle);
-                            }
-                        }
+                
preallocatedBundleToBroker.keySet().removeAll(preallocatedBundleData.keySet());

Review Comment:
   `keySet().removeAll` seems wrong



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