hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r711350 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Date Tue, 04 Nov 2008 18:45:21 GMT
Author: szetszwo
Date: Tue Nov  4 10:45:20 2008
New Revision: 711350

URL: http://svn.apache.org/viewvc?rev=711350&view=rev
Log:
HADOOP-4388. Datanode should handle invalid blocks and keep transferring the remaining blocks.
 (Suresh Srinivas via szetszwo)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=711350&r1=711349&r2=711350&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Nov  4 10:45:20 2008
@@ -77,6 +77,10 @@
     HADOOP-4346. Implement blocking connect so that Hadoop is not affected
     by selector problem with JDK default implementation. (Raghu Angadi)
 
+    HADOOP-4388. If there are invalid blocks in the transfer list, Datanode
+    should handle them and keep transferring the remaining blocks.  (Suresh
+    Srinivas via szetszwo)
+
 Release 0.19.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=711350&r1=711349&r2=711350&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java Tue Nov
 4 10:45:20 2008
@@ -858,34 +858,43 @@
     um.startUpgrade();
     return;
   }
+
+  private void transferBlock( Block block, 
+                              DatanodeInfo xferTargets[] 
+                              ) throws IOException {
+    if (!data.isValidBlock(block)) {
+      String errStr = "Can't send invalid block " + block;
+      LOG.info(errStr);
+      namenode.errorReport(dnRegistration, 
+                           DatanodeProtocol.INVALID_BLOCK, 
+                           errStr);
+      return;
+    }
+
+    int numTargets = xferTargets.length;
+    if (numTargets > 0) {
+      if (LOG.isInfoEnabled()) {
+        StringBuilder xfersBuilder = new StringBuilder();
+        for (int i = 0; i < numTargets; i++) {
+          xfersBuilder.append(xferTargets[i].getName());
+          xfersBuilder.append(" ");
+        }
+        LOG.info(dnRegistration + " Starting thread to transfer block " + 
+                 block + " to " + xfersBuilder);                       
+      }
+
+      new Daemon(new DataTransfer(xferTargets, block, this)).start();
+    }
+  }
+
   private void transferBlocks( Block blocks[], 
                                DatanodeInfo xferTargets[][] 
-                               ) throws IOException {
+                               ) {
     for (int i = 0; i < blocks.length; i++) {
-      if (!data.isValidBlock(blocks[i])) {
-        String errStr = "Can't send invalid block " + blocks[i];
-        LOG.info(errStr);
-        namenode.errorReport(dnRegistration, 
-                             DatanodeProtocol.INVALID_BLOCK, 
-                             errStr);
-        break;
-      }
-      int numTargets = xferTargets[i].length;
-      if (numTargets > 0) {
-        if (LOG.isInfoEnabled()) {
-          StringBuilder xfersBuilder = new StringBuilder();
-          for (int j = 0; j < numTargets; j++) {
-            DatanodeInfo nodeInfo = xferTargets[i][j];
-            xfersBuilder.append(nodeInfo.getName());
-            if (j < (numTargets - 1)) {
-              xfersBuilder.append(", ");
-            }
-          }
-          String xfersTo = xfersBuilder.toString();
-          LOG.info(dnRegistration + " Starting thread to transfer block " + 
-                   blocks[i] + " to " + xfersTo);                       
-        }
-        new Daemon(new DataTransfer(xferTargets[i], blocks[i], this)).start();
+      try {
+        transferBlock(blocks[i], xferTargets[i]);
+      } catch (IOException ie) {
+        LOG.warn("Failed to transfer block " + blocks[i], ie);
       }
     }
   }



Mime
View raw message