Demogorgon314 commented on code in PR #20822:
URL: https://github.com/apache/pulsar/pull/20822#discussion_r1267668452


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -659,12 +660,25 @@ public synchronized void doLoadShedding() {
                     if (!shouldAntiAffinityNamespaceUnload(namespaceName, 
bundleRange, broker)) {
                         return;
                     }
+                    NamespaceBundle bundleToUnload = 
LoadManagerShared.getNamespaceBundle(pulsar, bundle);
+                    Optional<String> destBroker = 
this.selectBroker(bundleToUnload);
+                    if (!destBroker.isPresent()) {
+                        log.warn("No broker available to unload bundle {} from 
broker {}", bundle, broker);
+                        return;
+                    }
+                    if (destBroker.get().equals(broker)) {
+                        log.warn("Bundle {} destination broker {} is the same 
as the source broker {}",
+                                bundle, destBroker.get(), broker);
+                        return;
+                    }
 
-                    log.info("[{}] Unloading bundle: {} from broker {}",
-                            strategy.getClass().getSimpleName(), bundle, 
broker);
+                    log.info("[{}] Unloading bundle: {} from broker {} to dest 
broker {}",
+                            strategy.getClass().getSimpleName(), bundle, 
broker, destBroker.get());
                     try {
-                        
pulsar.getAdminClient().namespaces().unloadNamespaceBundle(namespaceName, 
bundleRange);
+                        pulsar.getAdminClient().namespaces()
+                                .unloadNamespaceBundle(namespaceName, 
bundleRange, destBroker.get());

Review Comment:
   The `destinationBroker` parameter is added in this PR: 
https://github.com/apache/pulsar/pull/18663



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