You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by st...@apache.org on 2011/10/08 12:42:02 UTC

svn commit: r1180354 - /hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java

Author: stevel
Date: Sat Oct  8 10:42:02 2011
New Revision: 1180354

URL: http://svn.apache.org/viewvc?rev=1180354&view=rev
Log:
HDFS-2209 datanode connection failure logging

Modified:
    hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java

Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java?rev=1180354&r1=1180353&r2=1180354&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java Sat Oct  8 10:42:02 2011
@@ -388,6 +388,8 @@ public class DFSInputStream extends FSIn
     DatanodeInfo chosenNode = null;
     int refetchToken = 1; // only need to get a new access token once
     
+    boolean connectFailedOnce = false;
+
     while (true) {
       //
       // Compute desired block
@@ -409,6 +411,10 @@ public class DFSInputStream extends FSIn
             accessToken,
             offsetIntoBlock, blk.getNumBytes() - offsetIntoBlock,
             buffersize, verifyChecksum, dfsClient.clientName);
+        if(connectFailedOnce) {
+          DFSClient.LOG.info("Successfully connected to " + targetAddr +
+                             " for block " + blk.getBlockId());
+        }
         return chosenNode;
       } catch (IOException ex) {
         if (ex instanceof InvalidBlockTokenException && refetchToken > 0) {
@@ -428,11 +434,9 @@ public class DFSInputStream extends FSIn
           refetchToken--;
           fetchBlockAt(target);
         } else {
-          DFSClient.LOG.warn("Failed to connect to " + targetAddr
-              + ", add to deadNodes and continue " + ex);
-          if (DFSClient.LOG.isDebugEnabled()) {
-            DFSClient.LOG.debug("Connection failure ", ex);
-          }
+          connectFailedOnce = true;
+          DFSClient.LOG.warn("Failed to connect to " + targetAddr + " for block"
+            + ", add to deadNodes and continue. " + ex, ex);
           // Put chosen node into dead list, continue
           addToDeadNodes(chosenNode);
         }