Pomelongan commented on code in PR #17946:
URL: https://github.com/apache/pulsar/pull/17946#discussion_r995389338
##########
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 partition-0 maybe also created by the `CreateMissedPartitions`, I
think we should list the subscriptions of the partitioned topic.
>
> And for Pulsar, users can subscription to a specific partition, which
means partition-0, partition-1 might have different subscriptions.
I think we can add a parameter to specify the subscription name list to be
created, which can solve these two problems at the same time. How about this?
--
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]