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


##########
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();
+        } catch (PulsarServerException e1) {
+            result.completeExceptionally(e1);
+            return result;
+        }
+        
admin.topics().getStatsAsync(topicName.getPartition(0).toString()).thenAccept(stats
 -> {

Review Comment:
   > The challenge is that we don't have subscriptions for the partitioned 
topic, right?
   
    @codelipenghui Yes, adding a parameter to specify the subscription list to 
be created can solve this problem. I have updated the code,PTAL
   
   > Hmmm, IMO, we can update the documentation to remind the user that "If you 
found the partitions is missed, you should use create missed partitions command 
to fix the missed partition issue and try to subscribe to the partitioned topic 
again to repair the part of the subscription missed issue"
   
   Okay, I have updated the document.



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