You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zi...@apache.org on 2025/02/07 03:44:39 UTC
(pulsar) 02/05: [cleanup][admin] Do not print full stacktrace when get partitioned metadata not found (#20979)
This is an automated email from the ASF dual-hosted git repository.
zike pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit c269e380981c5cddafcb394cdb94c21832129831
Author: Kai Wang <kw...@apache.org>
AuthorDate: Mon Aug 14 15:25:30 2023 +0800
[cleanup][admin] Do not print full stacktrace when get partitioned metadata not found (#20979)
(cherry picked from commit 75d4d82c5fb419c67c259f86e0342704b2ed581b)
---
.../org/apache/pulsar/broker/admin/v1/PersistentTopics.java | 12 ++++++++++--
.../org/apache/pulsar/broker/admin/v2/PersistentTopics.java | 12 ++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/PersistentTopics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/PersistentTopics.java
index e9bb1a40547..d9b7430072b 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/PersistentTopics.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/PersistentTopics.java
@@ -41,6 +41,7 @@ import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.pulsar.broker.admin.AdminResource;
import org.apache.pulsar.broker.admin.impl.PersistentTopicsBase;
import org.apache.pulsar.broker.service.BrokerServiceException;
import org.apache.pulsar.broker.web.RestException;
@@ -320,8 +321,15 @@ public class PersistentTopics extends PersistentTopicsBase {
internalGetPartitionedMetadataAsync(authoritative, checkAllowAutoCreation)
.thenAccept(asyncResponse::resume)
.exceptionally(ex -> {
- if (!isRedirectException(ex)) {
- log.error("[{}] Failed to get partitioned metadata topic {}", clientAppId(), topicName, ex);
+ Throwable t = FutureUtil.unwrapCompletionException(ex);
+ if (!isRedirectException(t)) {
+ if (AdminResource.isNotFoundException(t)) {
+ log.error("[{}] Failed to get partitioned metadata topic {}: {}",
+ clientAppId(), topicName, ex.getMessage());
+ } else {
+ log.error("[{}] Failed to get partitioned metadata topic {}",
+ clientAppId(), topicName, t);
+ }
}
resumeAsyncResponseExceptionally(asyncResponse, ex);
return null;
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
index 2e1b943a2cc..b1570b26f61 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
@@ -46,6 +46,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
+import org.apache.pulsar.broker.admin.AdminResource;
import org.apache.pulsar.broker.admin.impl.PersistentTopicsBase;
import org.apache.pulsar.broker.service.BrokerServiceException;
import org.apache.pulsar.broker.web.RestException;
@@ -936,8 +937,15 @@ public class PersistentTopics extends PersistentTopicsBase {
internalGetPartitionedMetadataAsync(authoritative, checkAllowAutoCreation)
.thenAccept(asyncResponse::resume)
.exceptionally(ex -> {
- if (!isRedirectException(ex)) {
- log.error("[{}] Failed to get partitioned metadata topic {}", clientAppId(), topicName, ex);
+ Throwable t = FutureUtil.unwrapCompletionException(ex);
+ if (!isRedirectException(t)) {
+ if (AdminResource.isNotFoundException(t)) {
+ log.error("[{}] Failed to get partitioned metadata topic {}: {}",
+ clientAppId(), topicName, ex.getMessage());
+ } else {
+ log.error("[{}] Failed to get partitioned metadata topic {}",
+ clientAppId(), topicName, t);
+ }
}
resumeAsyncResponseExceptionally(asyncResponse, ex);
return null;