gaoran10 commented on code in PR #21213:
URL: https://github.com/apache/pulsar/pull/21213#discussion_r1338998593


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:
##########
@@ -377,25 +416,38 @@ public CompletableFuture<Optional<BrokerLookupData>> 
assign(Optional<ServiceUnit
             if (topic.isPresent() && isInternalTopic(topic.get().toString())) {
                 owner = serviceUnitStateChannel.getChannelOwnerAsync();
             } else {
-                owner = getOwnerAsync(serviceUnit, bundle, 
false).thenApply(Optional::ofNullable);
+                String candidateBrokerId = 
getHeartbeatOrSLAMonitorBrokerId(serviceUnit);
+                if (candidateBrokerId != null) {
+                    owner = 
CompletableFuture.completedFuture(Optional.of(candidateBrokerId));
+                } else {
+                    owner = getOrSelectOwnerAsync(serviceUnit, 
bundle).thenApply(Optional::ofNullable);
+                }
             }
             return getBrokerLookupData(owner, bundle);
         });
     }
 
-    private CompletableFuture<String> getOwnerAsync(
-            ServiceUnitId serviceUnit, String bundle, boolean 
ownByLocalBrokerIfAbsent) {
+    private String getHeartbeatOrSLAMonitorBrokerId(ServiceUnitId serviceUnit) 
{

Review Comment:
   Maybe we can add this method in NamespaceService, it will be used in 
different load manager implementations.



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