Skip to content

Commit

Permalink
[improve][broker] Optimize the logic of terminating system topic (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
yuruguo authored Aug 23, 2022
1 parent beb9204 commit 6dffa1d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3675,6 +3675,11 @@ protected CompletableFuture<Void> internalRemoveMaxConsumers(boolean isGlobal) {
}

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);
Expand All @@ -3689,10 +3694,6 @@ protected CompletableFuture<MessageId> internalTerminateAsync(boolean authoritat
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 -> {
Expand Down

0 comments on commit 6dffa1d

Please sign in to comment.