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

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


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 071d199  HDFS-14785. [SBN read] Change client logging to be less 
aggressive. Contributed by Chen Liang.
071d199 is described below

commit 071d199774f25a446878edcb9493e7579516e4ff
Author: Chen Liang <cli...@apache.org>
AuthorDate: Thu Sep 26 16:06:35 2019 -0700

    HDFS-14785. [SBN read] Change client logging to be less aggressive. 
Contributed by Chen Liang.
---
 .../namenode/ha/ObserverReadProxyProvider.java     | 25 ++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
index c758bde..20baac0 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
@@ -280,8 +280,10 @@ public class ObserverReadProxyProvider<T extends 
ClientProtocol>
     } catch (IOException e) {
       ioe = e;
     }
-    LOG.info("Failed to connect to {}. Assuming Standby state",
-        proxyInfo.getAddress(), ioe);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Failed to connect to {} while fetching HAServiceState",
+          proxyInfo.getAddress(), ioe);
+    }
     return HAServiceState.STANDBY;
   }
 
@@ -413,10 +415,21 @@ public class ObserverReadProxyProvider<T extends 
ClientProtocol>
           }
         }
 
-        // If we get here, it means all observers have failed.
-        LOG.warn("{} observers have failed for read request {}; also found " +
-            "{} standby and {} active. Falling back to active.",
-            failedObserverCount, method.getName(), standbyCount, activeCount);
+        // Only log message if there are actual observer failures.
+        // Getting here with failedObserverCount = 0 could
+        // be that there is simply no Observer node running at all.
+        if (failedObserverCount > 0) {
+          // If we get here, it means all observers have failed.
+          LOG.warn("{} observers have failed for read request {}; "
+                  + "also found {} standby, {} active. "
+                  + "Falling back to active.", failedObserverCount,
+              method.getName(), standbyCount, activeCount);
+        } else {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Read falling back to active without observer read "
+                + "fail, is there no observer node running?");
+          }
+        }
       }
 
       // Either all observers have failed, or that it is a write request.


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

Reply via email to