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

[transactions] Reduce spammy log during broker shutdown #1896

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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 @@ -52,6 +52,7 @@
import org.apache.kafka.common.requests.TransactionResult;
import org.apache.kafka.common.requests.WriteTxnMarkersRequest.TxnMarkerEntry;
import org.apache.pulsar.client.api.Authentication;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.impl.AuthenticationUtil;
import org.apache.pulsar.common.util.FutureUtil;
import org.apache.pulsar.common.util.netty.ChannelFutures;
Expand Down Expand Up @@ -329,7 +330,13 @@ public void addTxnMarkersToBrokerQueue(String transactionalId,

addressFuture.whenComplete((address, throwable) -> {
if (throwable != null) {
log.warn("Failed to find broker for topic partition {}", topicPartition, throwable);
if (throwable instanceof PulsarClientException.LookupException
|| throwable.getCause() instanceof PulsarClientException.LookupException) {
log.warn("Failed to find broker for topic partition {} - {}", topicPartition,
throwable + "");
} else {
log.warn("Failed to find broker for topic partition {}", topicPartition, throwable);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could it reduce the spammy logs? For the lookup exception, there are still warn logs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but when the cause is LookupException, it won't print the stack info.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't print the stack info.

I think not. See line 335, it's still log.warn.

unknownBrokerTopicList.add(topicPartition);
addFuture.complete(null);
return;
Expand Down