mattisonchao commented on a change in pull request #13805:
URL: https://github.com/apache/pulsar/pull/13805#discussion_r791305527
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -560,23 +560,12 @@ protected PartitionedTopicMetadata
internalGetPartitionedMetadata(boolean author
protected void internalDeletePartitionedTopic(AsyncResponse asyncResponse,
boolean authoritative,
boolean force, boolean
deleteSchema) {
- try {
- validateNamespaceOperation(topicName.getNamespaceObject(),
NamespaceOperation.DELETE_TOPIC);
- validateTopicOwnership(topicName, authoritative);
- } catch (WebApplicationException wae) {
- if (log.isDebugEnabled()) {
- log.debug("[{}] Failed to delete partitioned topic {},
redirecting to other brokers.",
- clientAppId(), topicName, wae);
- }
- resumeAsyncResponseExceptionally(asyncResponse, wae);
- return;
- } catch (Exception e) {
- log.error("[{}] Failed to delete partitioned topic {}",
clientAppId(), topicName, e);
- resumeAsyncResponseExceptionally(asyncResponse, e);
- return;
- }
+ CompletableFuture<PartitionedTopicMetadata>
partitionedTopicMetadataCompletableFuture =
+
validateNamespaceOperationAsync(topicName.getNamespaceObject(),
NamespaceOperation.DELETE_TOPIC)
+ .thenAccept(__ -> validateTopicOwnershipAsync(topicName,
authoritative))
+ .thenCompose(__ ->
pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(topicName));
final CompletableFuture<Void> future = new CompletableFuture<>();
Review comment:
I refactored this method to make it clearer. :-)
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
##########
@@ -867,22 +867,42 @@ public void validateTenantOperation(String tenant,
TenantOperation operation) {
}
public void validateNamespaceOperation(NamespaceName namespaceName,
NamespaceOperation operation) {
+ try {
+ validateNamespaceOperationAsync(namespaceName, operation).get();
Review comment:
done.
--
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]