You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2024/03/06 17:50:03 UTC

(pulsar) 03/06: [improve][broker] Avoid print redirect exception log when get list from bundle (#20846)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit e530c8bf1f14564b00a78e9456ba07ca563a3adb
Author: Kai Wang <kw...@apache.org>
AuthorDate: Sun Jul 23 12:56:04 2023 +0800

    [improve][broker] Avoid print redirect exception log when get list from bundle (#20846)
    
    (cherry picked from commit 9256407cdca1ab6d9b3a59ce404dccb09953ab24)
---
 .../pulsar/broker/admin/v2/NonPersistentTopics.java | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java
index 7cb18264ea1..80d6a9f62da 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java
@@ -461,25 +461,20 @@ public class NonPersistentTopics extends PersistentTopics {
                             }
                             asyncResponse.resume(topicList);
                         }).exceptionally(ex -> {
-                            Throwable realCause = FutureUtil.unwrapCompletionException(ex);
-                            log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(),
-                                    namespaceName, bundleRange, realCause);
-                            if (realCause instanceof WebApplicationException) {
-                                asyncResponse.resume(realCause);
-                            } else {
-                                asyncResponse.resume(new RestException(realCause));
+                            if (!isRedirectException(ex)) {
+                                log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(),
+                                        namespaceName, bundleRange, ex);
                             }
+                            resumeAsyncResponseExceptionally(asyncResponse, ex);
                             return null;
                         });
             }
         }).exceptionally(ex -> {
-            log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(),
-                namespaceName, bundleRange, ex);
-            if (ex.getCause() instanceof WebApplicationException) {
-                asyncResponse.resume(ex.getCause());
-            } else {
-                asyncResponse.resume(new RestException(ex.getCause()));
+            if (!isRedirectException(ex)) {
+                log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(),
+                        namespaceName, bundleRange, ex);
             }
+            resumeAsyncResponseExceptionally(asyncResponse, ex);
             return null;
         });
     }