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/19 10:32:46 UTC

[GitHub] [pulsar] AnonHxy commented on a diff in pull request #17946: [improve][broker]Create missed subscriptions for createMissedPartitions

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -505,26 +505,29 @@ protected CompletableFuture<Void> internalUpdatePartitionedTopicAsync(int numPar
             });
     }
 
-    protected void internalCreateMissedPartitions(AsyncResponse asyncResponse) {
-        getPartitionedTopicMetadataAsync(topicName, false, false).thenAccept(metadata -> {
-            if (metadata != null) {
-                tryCreatePartitionsAsync(metadata.partitions).thenAccept(v -> {
+    protected void internalCreateMissedPartitions(AsyncResponse asyncResponse, List<String> subscriptions) {
+        getPartitionedTopicMetadataAsync(topicName, false, false)
+                .thenApply(metadata -> {
+                    if (metadata == null) {
+                        throw new RestException(Status.NOT_FOUND, String.format(
+                                "Partitioned Topic not found: %s ,has no metadata", topicName.toString()));
+                    }
+                    return metadata;
+                })
+                .thenCompose(metadata ->
+                        tryCreatePartitionsAsync(metadata.partitions).thenApply(ignore -> metadata.partitions))

Review Comment:
   ```suggestion
                   .thenCompose(metadata -> {
                    if (metadata == null) {
                           throw new RestException(Status.NOT_FOUND, String.format(
                                   "Partitioned Topic not found: %s ,has no metadata", topicName.toString()));
                       }
                        return tryCreatePartitionsAsync(metadata.partitions).thenApply(ignore -> metadata.partitions));
                  }
   ```



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