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

penghui pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 46bc7f54ecc285c23db2f78f76bd1343b160af8b
Author: lipenghui <[email protected]>
AuthorDate: Thu Oct 21 14:30:34 2021 +0800

    Change the producer fence error log to debug level (#12447)
    
    
    (cherry picked from commit 64c441945ece5b2ddd7f2a3e82323a5130774438)
---
 .../main/java/org/apache/pulsar/client/impl/ProducerImpl.java    | 9 ++++++++-
 .../java/org/apache/pulsar/functions/worker/WorkerUtils.java     | 4 +++-
 2 files changed, 11 insertions(+), 2 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 615d299..239ee60 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
@@ -1443,7 +1443,14 @@ public class ProducerImpl<T> extends ProducerBase<T> 
implements TimerTask, Conne
                         cnx.channel().close();
                         return null;
                     }
-                    log.error("[{}] [{}] Failed to create producer: {}", 
topic, producerName, cause.getMessage());
+                    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 exists.
                     if (cause instanceof 
PulsarClientException.TopicDoesNotExistException) {
                         closeAsync().whenComplete((v, ex) -> {
diff --git 
a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerUtils.java
 
b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerUtils.java
index d7c6a71..4f0287f 100644
--- 
a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerUtils.java
+++ 
b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerUtils.java
@@ -352,7 +352,9 @@ public final class WorkerUtils {
                 }
                 tries++;
                 if (tries % 6 == 0) {
-                    log.warn("Failed to acquire exclusive producer to topic {} 
after {} attempts.  Will retry if we are still the leader.", topic, tries);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Failed to acquire exclusive producer to 
topic {} after {} attempts.  Will retry if we are still the leader.", topic, 
tries);
+                    }
                 }
                 Thread.sleep(sleepInBetweenMs);
             } while (isLeader.get());

Reply via email to