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/02/13 02:16:19 UTC

[GitHub] [pulsar] mattisonchao opened a new pull request #14258: [Management] Optimize ``BrokerBase`` log.

mattisonchao opened a new pull request #14258:
URL: https://github.com/apache/pulsar/pull/14258


   ### Motivation
   
   When a user calls the admin rest API resulting in an exception, we need to add an error log,
    it is very helpful for the user to understand what happened.
   
   ### Modifications
   
   - Add some logs for the ``BrokerBase`` method.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
   
   - [x] `no-need-doc` 
    


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



[GitHub] [pulsar] codelipenghui merged pull request #14258: [Management] Optimize ``BrokerBase`` log.

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14258:
URL: https://github.com/apache/pulsar/pull/14258


   


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



[GitHub] [pulsar] Shoothzj commented on a change in pull request #14258: [Management] Optimize ``BrokerBase`` log.

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #14258:
URL: https://github.com/apache/pulsar/pull/14258#discussion_r805449823



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
##########
@@ -851,4 +851,17 @@ protected void validatePersistencePolicies(PersistencePolicies persistence) {
                         persistence.getBookkeeperAckQuorum()));
 
     }
-}
+
+    /**
+     * Check current exception whether is redirect exception.
+     *
+     * @param ex The throwable.
+     * @return Whether is redirect exception
+     */
+     protected static boolean isRedirectException(Throwable ex) {
+        Throwable realCause = FutureUtil.unwrapCompletionException(ex);
+        return realCause instanceof WebApplicationException
+                && ((WebApplicationException) realCause).getResponse().getStatus()
+                        == Status.TEMPORARY_REDIRECT.getStatusCode();
+    }
+}

Review comment:
       better have a new line on the end
   ```suggestion
   }
   
   ```




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



[GitHub] [pulsar] Shoothzj commented on a change in pull request #14258: [Management] Optimize ``BrokerBase`` log.

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #14258:
URL: https://github.com/apache/pulsar/pull/14258#discussion_r805449823



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
##########
@@ -851,4 +851,17 @@ protected void validatePersistencePolicies(PersistencePolicies persistence) {
                         persistence.getBookkeeperAckQuorum()));
 
     }
-}
+
+    /**
+     * Check current exception whether is redirect exception.
+     *
+     * @param ex The throwable.
+     * @return Whether is redirect exception
+     */
+     protected static boolean isRedirectException(Throwable ex) {
+        Throwable realCause = FutureUtil.unwrapCompletionException(ex);
+        return realCause instanceof WebApplicationException
+                && ((WebApplicationException) realCause).getResponse().getStatus()
+                        == Status.TEMPORARY_REDIRECT.getStatusCode();
+    }
+}

Review comment:
       better have a new line on the end
   ```suggestion
   }
   
   ```




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