This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 5e5d514174f [improve][broker] Avoid logging errors when there is a
connection issue during subscription. (#23939)
5e5d514174f is described below
commit 5e5d514174fdbc1b400df51fafaa18110f1c31a9
Author: Zike Yang <[email protected]>
AuthorDate: Thu Feb 6 21:03:10 2025 +0800
[improve][broker] Avoid logging errors when there is a connection issue
during subscription. (#23939)
---
.../org/apache/pulsar/broker/service/BrokerServiceException.java | 6 ++++++
.../pulsar/broker/service/nonpersistent/NonPersistentTopic.java | 3 ++-
.../apache/pulsar/broker/service/persistent/PersistentTopic.java | 5 ++++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java
index d30dfc319e0..43a95cc8601 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java
@@ -218,6 +218,12 @@ public class BrokerServiceException extends Exception {
}
}
+ public static class ConnectionClosedException extends
BrokerServiceException {
+ public ConnectionClosedException(String msg) {
+ super(msg);
+ }
+ }
+
public static class TopicBacklogQuotaExceededException extends
BrokerServiceException {
@Getter
private final BacklogQuota.RetentionPolicy retentionPolicy;
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
index 7cdc8cc11a4..1931a09497e 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
@@ -351,7 +351,8 @@ public class NonPersistentTopic extends AbstractTopic
implements Topic, TopicPol
consumer.consumerName(), currentUsageCount());
}
future.completeExceptionally(
- new BrokerServiceException("Connection was closed
while the opening the cursor "));
+ new
BrokerServiceException.ConnectionClosedException(
+ "Connection was closed while the opening
the cursor "));
} else {
log.info("[{}][{}] Created new subscription for {}",
topic, subscriptionName, consumerId);
future.complete(consumer);
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
index e920c483bb3..ed05e47ed38 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
@@ -1031,7 +1031,8 @@ public class PersistentTopic extends AbstractTopic
implements Topic, AddEntryCal
decrementUsageCount();
return FutureUtil.failedFuture(
- new BrokerServiceException("Connection was
closed while the opening the cursor "));
+ new
BrokerServiceException.ConnectionClosedException(
+ "Connection was closed while the
opening the cursor "));
} else {
checkReplicatedSubscriptionControllerState();
if (log.isDebugEnabled()) {
@@ -1068,6 +1069,8 @@ public class PersistentTopic extends AbstractTopic
implements Topic, AddEntryCal
log.warn("[{}][{}] has been fenced. closing the topic {}",
topic, subscriptionName,
ex.getMessage());
close();
+ } else if (ex.getCause() instanceof
BrokerServiceException.ConnectionClosedException) {
+ log.warn("[{}][{}] Connection was closed while the opening
the cursor", topic, subscriptionName);
} else {
log.error("[{}] Failed to create subscription: {}", topic,
subscriptionName, ex);
}