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 2021/11/19 08:52:37 UTC

[GitHub] [pulsar] yuruguo opened a new pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

yuruguo opened a new pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891


   ### Motivation
   CLI `bin/pulsar-admin` supports `set-replicated-subscription-status` but lacks corresponding `get-replicated-subscription-status` command,  the purpose of this PR is to add this command.
   
   ### Documentation
   Automatically generate doc through code
   - doc


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



[GitHub] [pulsar] Anonymitaet commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975002950


   @yuruguo 
   ![image](https://user-images.githubusercontent.com/50226895/142790054-dbaa3568-bdff-4873-8df5-d460ecd9fc39.png)
   


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975336678


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-979276771


   @merlimat @eolivelli @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo commented on a change in pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on a change in pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#discussion_r754039900



##########
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:
       Thanks for your sugesstion and I have add related logic, PTAL again :)




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



[GitHub] [pulsar] github-actions[bot] commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-973876790


   @yuruguo:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


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



[GitHub] [pulsar] codelipenghui merged pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891


   


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



[GitHub] [pulsar] yuruguo edited a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo edited a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-979276771


   @merlimat @eolivelli @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-977246193


   @315157973 @hangc0276 @freeznet can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975463291


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-976003036


   @315157973 @hangc0276 PTAL


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-979276771


   @eolivelli @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975521553


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975324778


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-973982070


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975318713


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975409307


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-982318315


   @merlimat @eolivelli @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-973982070


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975521553


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-978481586


   @merlimat @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975324778


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975336678


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-976003036


   @315157973 @hangc0276 PTAL


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975318713


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo commented on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo commented on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975463291


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-975409307


   /pulsarbot run-failure-checks


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-978481586


   @merlimat @315157973 @hangc0276 can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-977246193


   @315157973 @hangc0276 @freeznet can you help review this pr?


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



[GitHub] [pulsar] yuruguo removed a comment on pull request #12891: [pulsar-admin] Add get-replicated-subscription-status command for topic

Posted by GitBox <gi...@apache.org>.
yuruguo removed a comment on pull request #12891:
URL: https://github.com/apache/pulsar/pull/12891#issuecomment-982318315


   @merlimat @eolivelli @315157973 @hangc0276 can you help review this pr?


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