diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java index 4756b885ff217..ad2d00fcb3e0e 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java @@ -560,16 +560,6 @@ private void updateBundleData() { } } - //Remove not active bundle from loadData - for (String bundle : bundleData.keySet()) { - if (!activeBundles.contains(bundle)){ - bundleData.remove(bundle); - if (pulsar.getLeaderElectionService().isLeader()){ - deleteBundleDataFromMetadataStore(bundle); - } - } - } - // Remove all loaded bundles from the preallocated maps. final Map preallocatedBundleData = brokerData.getPreallocatedBundleData(); Set ownedNsBundles = pulsar.getNamespaceService().getOwnedServiceUnits() @@ -604,6 +594,16 @@ private void updateBundleData() { LoadManagerShared.fillNamespaceToBundlesMap(preallocatedBundleData.keySet(), namespaceToBundleRange); } } + + //Remove not active bundle from loadData + for (String bundle : bundleData.keySet()) { + if (!activeBundles.contains(bundle)){ + bundleData.remove(bundle); + if (pulsar.getLeaderElectionService().isLeader()){ + deleteBundleDataFromMetadataStore(bundle); + } + } + } } /**