hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1214082 - in /hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common: CHANGES.HDFS-1623.txt src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java src/main/java/org/apache/hadoop/ipc/Server.java
Date Wed, 14 Dec 2011 07:51:31 GMT
Author: todd
Date: Wed Dec 14 07:51:30 2011
New Revision: 1214082

URL: http://svn.apache.org/viewvc?rev=1214082&view=rev
Log:
HADOOP-7922. Improve some logging for client IPC failovers and StandbyExceptions. Contributed
by Todd Lipcon.

Modified:
    hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/CHANGES.HDFS-1623.txt
    hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
    hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java

Modified: hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/CHANGES.HDFS-1623.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/CHANGES.HDFS-1623.txt?rev=1214082&r1=1214081&r2=1214082&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/CHANGES.HDFS-1623.txt
(original)
+++ hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/CHANGES.HDFS-1623.txt
Wed Dec 14 07:51:30 2011
@@ -10,3 +10,6 @@ HADOOP-7774. HA: Administrative CLI to c
 
 HADOOP-7896. HA: if both NNs are in Standby mode, client needs to try failing
              back and forth several times with sleeps. (atm)
+
+HADOOP-7922. Improve some logging for client IPC failovers and
+             StandbyExceptions (todd)

Modified: hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java?rev=1214082&r1=1214081&r2=1214082&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
(original)
+++ hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
Wed Dec 14 07:51:30 2011
@@ -93,16 +93,30 @@ class RetryInvocationHandler implements 
           }
           return null;
         } else { // retry or failover
+
+          if (action.action == RetryAction.RetryDecision.FAILOVER_AND_RETRY) {
+            String msg = "Exception while invoking " + method.getName()
+              + " of " + currentProxy.getClass()
+              + " after " + invocationFailoverCount + " fail over attempts."
+              + " Trying to fail over " + formatSleepMessage(action.delayMillis);
+            if (LOG.isDebugEnabled()) {
+              LOG.debug(msg, e);
+            } else {
+              LOG.warn(msg);
+            }
+          } else {
+            if(LOG.isDebugEnabled()) {
+              LOG.debug("Exception while invoking " + method.getName()
+                  + " of " + currentProxy.getClass() + ". Retrying " +
+                  formatSleepMessage(action.delayMillis), e);
+            }
+          }
           
           if (action.delayMillis > 0) {
             ThreadUtil.sleepAtLeastIgnoreInterrupts(action.delayMillis);
           }
           
           if (action.action == RetryAction.RetryDecision.FAILOVER_AND_RETRY) {
-            LOG.warn("Exception while invoking " + method.getName()
-                + " of " + currentProxy.getClass()
-                + " after " + invocationFailoverCount + " fail over attempts."
-                + " Trying to fail over.", e);
             // Make sure that concurrent failed method invocations only cause a
             // single actual fail over.
             synchronized (proxyProvider) {
@@ -118,14 +132,18 @@ class RetryInvocationHandler implements 
             invocationFailoverCount++;
           }
         }
-        if(LOG.isDebugEnabled()) {
-          LOG.debug("Exception while invoking " + method.getName()
-              + " of " + currentProxy.getClass() + ". Retrying.", e);
-        }
       }
     }
   }
-
+  
+  private static String formatSleepMessage(long millis) {
+    if (millis > 0) {
+      return "after sleeping for " + millis + "ms.";
+    } else {
+      return "immediately.";
+    }
+  }
+  
   private Object invokeMethod(Method method, Object[] args) throws Throwable {
     try {
       if (!method.isAccessible()) {

Modified: hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java?rev=1214082&r1=1214081&r2=1214082&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
(original)
+++ hadoop/common/branches/HDFS-1623/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
Wed Dec 14 07:51:30 2011
@@ -1616,6 +1616,10 @@ public abstract class Server {
               // on the server side, as opposed to just a normal exceptional
               // result.
               LOG.warn(logMsg, e);
+            } else if (e instanceof StandbyException) {
+              // Don't log the whole stack trace of these exceptions.
+              // Way too noisy!
+              LOG.info(logMsg);
             } else {
               LOG.info(logMsg, e);
             }



Mime
View raw message