aloyszhang commented on a change in pull request #13796:
URL: https://github.com/apache/pulsar/pull/13796#discussion_r786928753



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/common/naming/SpecifiedTopicCountEquallyDivideBundleSplitAlgorithm.java
##########
@@ -0,0 +1,38 @@
+package org.apache.pulsar.common.naming;
+
+
+import org.apache.pulsar.broker.namespace.NamespaceService;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+public class SpecifiedTopicCountEquallyDivideBundleSplitAlgorithm implements 
NamespaceBundleSplitAlgorithm{
+    @Override
+    public CompletableFuture<Long> getSplitBoundary(BundleSplitOption 
bundleSplitOption) {
+        NamespaceService service = bundleSplitOption.getService();
+        NamespaceBundle bundle = bundleSplitOption.getBundle();
+        String topicName = bundleSplitOption.getTopic();
+        return 
service.getOwnedTopicListForNamespaceBundle(bundle).thenCompose(topics -> {
+            if (topics == null || topics.size() <= 1) {
+                return CompletableFuture.completedFuture(null);
+            }
+            String targetTopicName = 
TopicName.get(topicName).getPartitionedTopicName();
+            List<Long> topicNameHashList = new ArrayList<>(topics.size());
+            for (String topic : topics) {
+                TopicName tName = TopicName.get(topic);
+                if (tName.isPartitioned() && 
tName.getPartitionedTopicName().equals(targetTopicName))

Review comment:
       fixed




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