Technoboy- commented on code in PR #16287:
URL: https://github.com/apache/pulsar/pull/16287#discussion_r916416032


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java:
##########
@@ -208,13 +208,20 @@ public void deleteNamespace(@Suspended final 
AsyncResponse asyncResponse, @PathP
             @ApiResponse(code = 307, message = "Current broker doesn't serve 
the namespace"),
             @ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Tenant or cluster or namespace 
doesn't exist"),
-            @ApiResponse(code = 409, message = "Namespace bundle is not 
empty") })
-    public void deleteNamespaceBundle(@PathParam("tenant") String tenant, 
@PathParam("namespace") String namespace,
-            @PathParam("bundle") String bundleRange,
-            @QueryParam("force") @DefaultValue("false") boolean force,
-            @QueryParam("authoritative") @DefaultValue("false") boolean 
authoritative) {
+            @ApiResponse(code = 409, message = "Namespace bundle is not 
empty")})
+    public void deleteNamespaceBundle(@Suspended AsyncResponse response, 
@PathParam("tenant") String tenant,
+                                      @PathParam("namespace") String namespace,
+                                      @PathParam("bundle") String bundleRange,
+                                      @QueryParam("force") 
@DefaultValue("false") boolean force,
+                                      @QueryParam("authoritative") 
@DefaultValue("false") boolean authoritative) {
         validateNamespaceName(tenant, namespace);
-        internalDeleteNamespaceBundle(bundleRange, authoritative, force);
+        internalDeleteNamespaceBundleAsync(bundleRange, authoritative, force)
+                .thenRun(() -> response.resume(Response.noContent().build()))
+                .exceptionally(ex -> {
+                    log.error("[{}] Failed to delete namespace bundle {}", 
clientAppId(), namespaceName, ex);

Review Comment:
   We have `validateClusterOwnershipAsync` which will redirect the request, so 
it's better to add `isRedirectException` to filter this exception.



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