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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -5145,27 +5145,54 @@ protected void 
internalGetReplicatedSubscriptionStatus(AsyncResponse asyncRespon
                     .thenCompose(__ -> 
getPartitionedTopicMetadataAsync(topicName, authoritative, false))
                     .thenAccept(partitionMetadata -> {
                         if (partitionMetadata.partitions > 0) {
-                            final List<CompletableFuture<Map<String, 
Boolean>>> futures =
-                                    
Lists.newArrayListWithCapacity(partitionMetadata.partitions);
-                            final Map<String, Boolean> status = 
Maps.newHashMap();
+                            List<CompletableFuture<Void>> futures = new 
ArrayList<>(partitionMetadata.partitions);
+                            Map<String, Boolean> status = Maps.newHashMap();
 
                             for (int i = 0; i < partitionMetadata.partitions; 
i++) {
                                 TopicName partition = 
topicName.getPartition(i);
-                                try {
-                                    
futures.add(pulsar().getAdminClient().topics().getReplicatedSubscriptionStatusAsync(
-                                            partition.toString(), 
subName).whenComplete((response, throwable) -> {
-                                        if (throwable != null) {
-                                            log.error("[{}] Failed to get 
replicated subscriptions on {} {}",
-                                                    clientAppId(), partition, 
subName, throwable);
-                                            asyncResponse.resume(new 
RestException(throwable));
+                                futures.add(
+                                    
pulsar().getNamespaceService().isServiceUnitOwnedAsync(partition)
+                                    .thenCompose(owned -> {
+                                        if (owned) {
+                                            // if this broker owned the 
partition do action like
+                                            // 
`internalGetReplicatedSubscriptionStatusForNonPartitionedTopic()`
+                                            return 
getTopicReferenceAsync(partition)
+                                                .thenApply(topic -> {

Review Comment:
   Yes. But `FutureUtil.waitForAll(futures)` on line5195 will handle this 
exception @codelipenghui 



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