codelipenghui commented on a change in pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#discussion_r753244893



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -4514,4 +4514,36 @@ private void 
internalSetReplicatedSubscriptionStatusForNonPartitionedTopic(Async
             resumeAsyncResponseExceptionally(asyncResponse, e);
         }
     }
+
+    protected Map<String, Boolean> internalGetReplicatedSubscriptionStatus() {
+        log.info("[{}] Attempting to get replicated subscription status on 
{}", clientAppId(), topicName);
+
+        // Reject the request if the topic is not persistent
+        if (!topicName.isPersistent()) {
+            new RestException(Status.METHOD_NOT_ALLOWED,
+                    "Cannot get replicated subscriptions on non-persistent 
topics");
+        }
+
+        // Reject the request if the topic is not global
+        if (!topicName.isGlobal()) {
+            new RestException(Status.METHOD_NOT_ALLOWED,
+                    "Cannot get replicated subscriptions on non-global 
topics");
+        }
+
+        // Permission to consume this topic is required
+        validateTopicOperation(topicName, 
TopicOperation.GET_REPLICATED_SUBSCRIPTION_STATUS);
+
+        Topic topic = getTopicReference(topicName);

Review comment:
       Need to check the ownership first, otherwise the topic might be owned by 
another broker.

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -4514,4 +4514,36 @@ private void 
internalSetReplicatedSubscriptionStatusForNonPartitionedTopic(Async
             resumeAsyncResponseExceptionally(asyncResponse, e);
         }
     }
+
+    protected Map<String, Boolean> internalGetReplicatedSubscriptionStatus() {
+        log.info("[{}] Attempting to get replicated subscription status on 
{}", clientAppId(), topicName);
+
+        // Reject the request if the topic is not persistent
+        if (!topicName.isPersistent()) {
+            new RestException(Status.METHOD_NOT_ALLOWED,
+                    "Cannot get replicated subscriptions on non-persistent 
topics");
+        }
+
+        // Reject the request if the topic is not global
+        if (!topicName.isGlobal()) {
+            new RestException(Status.METHOD_NOT_ALLOWED,
+                    "Cannot get replicated subscriptions on non-global 
topics");
+        }
+
+        // Permission to consume this topic is required
+        validateTopicOperation(topicName, 
TopicOperation.GET_REPLICATED_SUBSCRIPTION_STATUS);
+
+        Topic topic = getTopicReference(topicName);

Review comment:
       And the partitioned topic should be handled.




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