codelipenghui commented on code in PR #16676:
URL: https://github.com/apache/pulsar/pull/16676#discussion_r924353952


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -346,8 +346,15 @@ protected void internalDeleteNamespace(AsyncResponse 
asyncResponse, boolean auth
             asyncResponse.resume(Response.noContent().build());
         })
         .exceptionally(ex -> {
-            log.error("[{}] Failed to remove namespace {}", clientAppId(), 
namespaceName, ex.getCause());
-            resumeAsyncResponseExceptionally(asyncResponse, ex);
+            Throwable cause = FutureUtil.unwrapCompletionException(ex);
+            log.error("[{}] Failed to remove namespace {}", clientAppId(), 
namespaceName, cause);
+            if (cause instanceof PulsarAdminException.ConflictException) {
+                log.info("[{}] There are new topics created during the 
namespace deletion, "
+                        + "retry to delete the namespace again.", 
namespaceName);
+                internalDeleteNamespace(asyncResponse, authoritative);

Review Comment:
   Changed to use another thread to retry.
   I think no infinite loop here. When deleting the namespace bundle, looks 
only reach the race condition will get ConflictException here. This is why the 
retry is not introduced to `internalDeleteNamespaceBundleAsync` method, it will 
run into infinite loop if users try to delete a bundle with topic.



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

Reply via email to