You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/25 02:48:22 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #6903: PIP-61: Advertise multiple addresses

codelipenghui commented on a change in pull request #6903:
URL: https://github.com/apache/pulsar/pull/6903#discussion_r429707325



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -36,11 +36,7 @@
 import java.lang.reflect.Method;
 import java.net.InetSocketAddress;
 import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;

Review comment:
       Avoid use import .*

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/lookup/TopicLookupBase.java
##########
@@ -156,6 +156,31 @@ protected String internalGetNamespaceBundle(TopicName topicName) {
      */
     public static CompletableFuture<ByteBuf> lookupTopicAsync(PulsarService pulsarService, TopicName topicName,
             boolean authoritative, String clientAppId, AuthenticationDataSource authenticationData, long requestId) {
+        return lookupTopicAsync(pulsarService, topicName, authoritative, clientAppId, authenticationData, requestId, null);
+    }
+
+    /**
+     *
+     * Lookup broker-service address for a given namespace-bundle which contains given topic.
+     *
+     * a. Returns broker-address if namespace-bundle is already owned by any broker b. If current-broker receives
+     * lookup-request and if it's not a leader then current broker redirects request to leader by returning
+     * leader-service address. c. If current-broker is leader then it finds out least-loaded broker to own namespace
+     * bundle and redirects request by returning least-loaded broker. d. If current-broker receives request to own the
+     * namespace-bundle then it owns a bundle and returns success(connect) response to client.

Review comment:
       It's better to use `owner` rather than `leader`.
   And, for easier reading. Please separate a b c d into different paragraphs.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org