Skip to content

Commit

Permalink
[cleanup][admin] Do not print full stacktrace when get partitioned me…
Browse files Browse the repository at this point in the history
…tadata not found (#20979)
  • Loading branch information
Demogorgon314 authored Aug 14, 2023
1 parent bafc827 commit 75d4d82
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
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;
Expand Down Expand Up @@ -320,8 +321,15 @@ public void getPartitionedMetadata(
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
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;
Expand Down Expand Up @@ -891,8 +892,15 @@ public void getPartitionedMetadata(
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;
Expand Down

0 comments on commit 75d4d82

Please sign in to comment.