This is an automated email from the ASF dual-hosted git repository.

baodi 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 a19eaa2b972 [improve][client] Avoid logging errors for retriable 
errors when creating producer (#23935)
a19eaa2b972 is described below

commit a19eaa2b972ab8fe1a2a45e65df1566cf28fb336
Author: Baodi Shi <[email protected]>
AuthorDate: Thu Feb 6 18:52:08 2025 +0800

    [improve][client] Avoid logging errors for retriable errors when creating 
producer (#23935)
---
 .../java/org/apache/pulsar/client/impl/ProducerImpl.java    | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 304b84961b7..fb2246f3a66 100644
--- 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -1917,14 +1917,6 @@ public class ProducerImpl<T> extends ProducerBase<T> 
implements TimerTask, Conne
                 cnx.sendRequestWithId(cmd, closeRequestId);
             }
 
-            if (cause instanceof 
PulsarClientException.ProducerFencedException) {
-                if (log.isDebugEnabled()) {
-                    log.debug("[{}] [{}] Failed to create producer: {}",
-                            topic, producerName, cause.getMessage());
-                }
-            } else {
-                log.error("[{}] [{}] Failed to create producer: {}", topic, 
producerName, cause.getMessage());
-            }
             // Close the producer since topic does not exist.
             if (cause instanceof 
PulsarClientException.TopicDoesNotExistException) {
                 closeAsync().whenComplete((v, ex) -> {
@@ -1936,6 +1928,7 @@ public class ProducerImpl<T> extends ProducerBase<T> 
implements TimerTask, Conne
                 future.complete(null);
                 return null;
             }
+
             if (cause instanceof 
PulsarClientException.ProducerBlockedQuotaExceededException) {
                 synchronized (this) {
                     log.warn("[{}] [{}] Topic backlog quota exceeded. Throwing 
Exception on producer.", topic,
@@ -1954,6 +1947,10 @@ public class ProducerImpl<T> extends ProducerBase<T> 
implements TimerTask, Conne
             } else if (cause instanceof 
PulsarClientException.ProducerBlockedQuotaExceededError) {
                 log.warn("[{}] [{}] Producer is blocked on creation because 
backlog exceeded on topic.",
                         producerName, topic);
+            } else if (PulsarClientException.isRetriableError(cause)) {
+                log.info("[{}] [{}] Temporary error in creating producer: {}", 
topic, producerName, cause.getMessage());
+            } else {
+                log.error("[{}] [{}] Failed to create producer: {}", topic, 
producerName, cause.getMessage());
             }
 
             if (cause instanceof 
PulsarClientException.TopicTerminatedException) {

Reply via email to