You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/27 03:03:14 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #18194: [improve][client]When namespace is deleted, the client is constantly reconnecting

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:
##########
@@ -822,8 +822,12 @@ protected void validateGlobalNamespaceOwnership(NamespaceName namespace) {
         } catch (WebApplicationException e) {
             throw e;
         } catch (Exception e) {
-            if (e.getCause() instanceof WebApplicationException) {
-                throw (WebApplicationException) e.getCause();
+            Throwable throwable = FutureUtil.unwrapCompletionException(e);
+            if (throwable instanceof WebApplicationException webApplicationException) {
+                throw webApplicationException;
+            }
+            if (throwable instanceof RestException restException){
+                throw restException;

Review Comment:
   We can remove these lines.
   The `RestException` is a sub-class of `WebApplicationException`



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:
##########
@@ -875,7 +879,7 @@ public static CompletableFuture<ClusterDataImpl> checkLocalOrGetPeerReplicationC
                 if (!allowDeletedNamespace && policies.deleted) {
                     String msg = String.format("Namespace %s is deleted", namespace.toString());
                     log.warn(msg);
-                    validationFuture.completeExceptionally(new RestException(Status.PRECONDITION_FAILED,
+                    validationFuture.completeExceptionally(new RestException(Status.NOT_FOUND,

Review Comment:
   It's incorrect here.
   If `allowDeletedNamespace` is false. We should return `Status.PRECONDITION_FAILED`. No matter if `policies.deleted` is true or false.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org