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 2022/10/08 06:09:11 UTC

[GitHub] [pulsar] Pomelongan commented on a diff in pull request #17946: [improve][broker]add the logic for creating missed subscriptions for createMissedPartitions

Pomelongan commented on code in PR #17946:
URL: https://github.com/apache/pulsar/pull/17946#discussion_r990596584


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -4552,6 +4555,75 @@ private CompletableFuture<Void> createSubscriptions(TopicName topicName, int num
         return result;
     }
 
+    /**
+     * It creates subscriptions for new partitions of existing partitioned-topics.
+     *
+     * @param topicName     : topic-name: persistent://prop/cluster/ns/topic
+     * @param numPartitions : number partitions for the topics
+     *
+     */
+    private CompletableFuture<Void> createMissedSubscriptionsAsync(TopicName topicName, int numPartitions) {
+        CompletableFuture<Void> result = new CompletableFuture<>();
+        PulsarAdmin admin;
+        try {
+            admin = pulsar().getAdminClient();

Review Comment:
   `org.apache.pulsar.broker.admin.impl.PersistentTopicsBase#internalCreateMissedPartitions` does not call `validateTopicOwnershipAsync` to verify whether the topic belongs to the broker, but only to determine whether the topic belongs to the namespace of the broker, so I have reserved the logic of using admin to create subscriptions in `org.apache.pulsar.broker.admin.impl.PersistentTopicsBase#createMissedSubscriptionsAsync`~
   
   



-- 
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: commits-unsubscribe@pulsar.apache.org

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