hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1180354 - /hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
Date Sat, 08 Oct 2011 10:42:02 GMT
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);
         }



Mime
View raw message