You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/08/23 07:44:24 UTC

[pulsar] branch master updated: [improve][broker] Optimize the logic of terminating system topic (#17210)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 6dffa1d92f9 [improve][broker] Optimize the logic of terminating system topic (#17210)
6dffa1d92f9 is described below

commit 6dffa1d92f98e8f275abb6af7a6fe52ab425ae78
Author: Ruguo Yu <ji...@163.com>
AuthorDate: Tue Aug 23 15:44:15 2022 +0800

    [improve][broker] Optimize the logic of terminating system topic (#17210)
---
 .../apache/pulsar/broker/admin/impl/PersistentTopicsBase.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
index 6521cee29ba..d9adc4ac20b 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
@@ -3675,6 +3675,11 @@ public class PersistentTopicsBase extends AdminResource {
     }
 
     protected CompletableFuture<MessageId> internalTerminateAsync(boolean authoritative) {
+        if (SystemTopicNames.isSystemTopic(topicName)) {
+            return FutureUtil.failedFuture(new RestException(Status.METHOD_NOT_ALLOWED,
+                    "Termination of a system topic is not allowed"));
+        }
+
         CompletableFuture<Void> ret;
         if (topicName.isGlobal()) {
             ret = validateGlobalNamespaceOwnershipAsync(namespaceName);
@@ -3689,10 +3694,6 @@ public class PersistentTopicsBase extends AdminResource {
                         throw new RestException(Status.METHOD_NOT_ALLOWED,
                                 "Termination of a partitioned topic is not allowed");
                     }
-                    if (SystemTopicNames.isSystemTopic(topicName)) {
-                        throw new RestException(Status.METHOD_NOT_ALLOWED,
-                                "Termination of a system topic is not allowed");
-                    }
                 })
                 .thenCompose(__ -> getTopicReferenceAsync(topicName))
                 .thenCompose(topic -> {