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/14 04:00:59 UTC

[GitHub] [pulsar] Demogorgon314 commented on a change in pull request #14259: [Management] Fix print error log when server return redirect (http code 307).

Demogorgon314 commented on a change in pull request #14259:
URL: https://github.com/apache/pulsar/pull/14259#discussion_r805489399



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -3552,12 +3597,14 @@ protected void internalExpireMessagesByPosition(AsyncResponse asyncResponse, Str
                                 }
                             });
                 }).exceptionally(ex -> {
-            Throwable cause = ex.getCause();
-            log.error("[{}] Failed to expire messages up to {} on subscription {} to position {}",
-                    clientAppId(), topicName, subName, messageId, cause);
-            resumeAsyncResponseExceptionally(asyncResponse, cause);
-            return null;
-        });
+                    // If the exception is not redirect exception we need to log it.
+                    if (!isRedirectException(ex)) {
+                        log.error("[{}] Failed to expire messages up to {} on subscription {} to position {}",
+                                clientAppId(), topicName, subName, messageId, ex);
+                    }
+                    resumeAsyncResponseExceptionally(asyncResponse, ex);

Review comment:
       ```suggestion
                       resumeAsyncResponseExceptionally(asyncResponse, ex.getCause());
   ```

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -3689,17 +3737,21 @@ protected void internalTriggerCompaction(AsyncResponse asyncResponse, boolean au
                         internalTriggerCompactionNonPartitionedTopic(asyncResponse, authoritative);
                     }
                 }).exceptionally(ex -> {
-                    Throwable cause = ex.getCause();
-                    log.error("[{}] Failed to trigger compaction on topic {}", clientAppId(), topicName, cause);
-                    resumeAsyncResponseExceptionally(asyncResponse, cause);
+                    // If the exception is not redirect exception we need to log it.
+                    if (!isRedirectException(ex)) {
+                        log.error("[{}] Failed to trigger compaction on topic {}", clientAppId(), topicName, ex);
+                    }
+                    resumeAsyncResponseExceptionally(asyncResponse, ex);

Review comment:
       ```suggestion
                       resumeAsyncResponseExceptionally(asyncResponse, ex.getCause());
   ```

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -753,22 +751,23 @@ protected void internalUnloadTopic(AsyncResponse asyncResponse, boolean authorit
                            } else {
                                internalUnloadNonPartitionedTopicAsync(asyncResponse, authoritative);
                            }
-                       }).exceptionally(t -> {
-                           log.error("[{}] Failed to get partitioned metadata while unloading topic {}",
-                                   clientAppId(), topicName, t);
-                           if (t instanceof WebApplicationException) {
-                               asyncResponse.resume(t);
-                           } else {
-                               asyncResponse.resume(new RestException(t));
+                       }).exceptionally(ex -> {
+                           // If the exception is not redirect exception we need to log it.
+                           if (!isRedirectException(ex)) {
+                               log.error("[{}] Failed to get partitioned metadata while unloading topic {}",
+                                       clientAppId(), topicName, ex);
                            }
+                           resumeAsyncResponseExceptionally(asyncResponse, ex);

Review comment:
       Need change to `ex.getCause()` too.




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