This is an automated email from the ASF dual-hosted git repository. technoboy pushed a commit to branch branch-2.11 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit eaf6e885ebb2258bd1bcf846954fbefb7c6d844b Author: Ruguo Yu <[email protected]> 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 -> {
