Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Fix topic lookup failed exceptionally with ServiceUnitNotReady #1995

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.broker.service.BrokerService;
Expand Down Expand Up @@ -96,8 +97,9 @@ private void handleGetTopicException(@NonNull final String topicName,
final CompletableFuture<Optional<PersistentTopic>> topicCompletableFuture,
@NonNull final Throwable ex,
@NonNull final Object requestor) {
final Throwable realThrowable = (ex instanceof CompletionException) ? ex.getCause() : ex;
// The ServiceUnitNotReadyException is retryable, so we should print a warning log instead of error log
if (ex instanceof BrokerServiceException.ServiceUnitNotReadyException) {
if (realThrowable instanceof BrokerServiceException.ServiceUnitNotReadyException) {
log.warn("[{}] Failed to getTopic {}: {}",
requestor, topicName, ex.getMessage());
topicCompletableFuture.complete(Optional.empty());
Expand Down
Loading