You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ta...@apache.org on 2022/04/11 06:20:21 UTC

[hadoop] branch branch-3.2 updated: HADOOP-17116. Skip Retry INFO logging on first failover from a proxy

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

tasanuma pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 9cdf5ca105e HADOOP-17116. Skip Retry INFO logging on first failover from a proxy
9cdf5ca105e is described below

commit 9cdf5ca105e549ab9f3d820ad2c6b5aae3267e81
Author: Hanisha Koneru <ha...@apache.org>
AuthorDate: Mon Jul 13 12:55:34 2020 -0700

    HADOOP-17116. Skip Retry INFO logging on first failover from a proxy
    
    (cherry picked from commit e62d8f841275ee47a0ba911415aac9e39af291c6)
---
 .../hadoop/io/retry/RetryInvocationHandler.java     | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
index 64824a15cd8..6db00d724aa 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
@@ -35,6 +35,7 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Map;
 
 /**
@@ -312,6 +313,8 @@ public class RetryInvocationHandler<T> implements RpcInvocationHandler {
 
   private volatile boolean hasSuccessfulCall = false;
 
+  private HashSet<String> failedAtLeastOnce = new HashSet<>();
+
   private final RetryPolicy defaultPolicy;
   private final Map<String,RetryPolicy> methodNameToPolicyMap;
 
@@ -390,12 +393,18 @@ public class RetryInvocationHandler<T> implements RpcInvocationHandler {
 
   private void log(final Method method, final boolean isFailover,
       final int failovers, final long delay, final Exception ex) {
-    // log info if this has made some successful calls or
-    // this is not the first failover
-    final boolean info = hasSuccessfulCall || failovers != 0
-        || asyncCallHandler.hasSuccessfulCall();
-    if (!info && !LOG.isDebugEnabled()) {
-      return;
+    boolean info = true;
+    // If this is the first failover to this proxy, skip logging at INFO level
+    if (!failedAtLeastOnce.contains(proxyDescriptor.getProxyInfo().toString()))
+    {
+      failedAtLeastOnce.add(proxyDescriptor.getProxyInfo().toString());
+
+      // If successful calls were made to this proxy, log info even for first
+      // failover
+      info = hasSuccessfulCall || asyncCallHandler.hasSuccessfulCall();
+      if (!info && !LOG.isDebugEnabled()) {
+        return;
+      }
     }
 
     final StringBuilder b = new StringBuilder()


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org