Browse Source

HDFS-4581. Merge r1461615 from branch-1

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2@1491535 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 12 years ago
parent
commit
1048a15538
2 changed files with 20 additions and 6 deletions
  1. 3 0
      CHANGES.txt
  2. 17 6
      src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

+ 3 - 0
CHANGES.txt

@@ -20,6 +20,9 @@ Release 1.2.1 - Unreleased
     MAPREDUCE-3859. Fix CapacityScheduler to correctly compute runtime queue
     MAPREDUCE-3859. Fix CapacityScheduler to correctly compute runtime queue
     limits for high-ram jobs. (Sergey Tryuber via acmurthy)
     limits for high-ram jobs. (Sergey Tryuber via acmurthy)
 
 
+    HDFS-4581. DataNode.checkDiskError should not be called on network errors.
+    (Rohit Kochar via kihwal)
+
 Release 1.2.0 - 2013.05.05
 Release 1.2.0 - 2013.05.05
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 17 - 6
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

@@ -27,8 +27,10 @@ import java.io.OutputStream;
 import java.net.InetSocketAddress;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.Socket;
+import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.net.SocketTimeoutException;
 import java.net.UnknownHostException;
 import java.net.UnknownHostException;
+import java.nio.channels.ClosedByInterruptException;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 import java.nio.channels.SocketChannel;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchAlgorithmException;
@@ -923,10 +925,16 @@ public class DataNode extends Configured
   /** Check if there is no space in disk 
   /** Check if there is no space in disk 
    *  @param e that caused this checkDiskError call
    *  @param e that caused this checkDiskError call
    **/
    **/
-  protected void checkDiskError(Exception e ) throws IOException {
-    
-    LOG.warn("checkDiskError: exception: ", e);
-    
+  protected void checkDiskError(Exception e ) throws IOException {    
+    LOG.warn("checkDiskError: exception: ", e);  
+    if (e instanceof SocketException || e instanceof SocketTimeoutException
+    	  || e instanceof ClosedByInterruptException 
+    	  || e.getMessage().startsWith("Broken pipe")) {
+      LOG.info("Not checking disk as checkDiskError was called on a network" +
+        " related exception");	
+      return;
+    }
+
     if (e.getMessage() != null &&
     if (e.getMessage() != null &&
         e.getMessage().startsWith("No space left on device")) {
         e.getMessage().startsWith("No space left on device")) {
       throw new DiskOutOfSpaceException("No space left on device");
       throw new DiskOutOfSpaceException("No space left on device");
@@ -1543,8 +1551,11 @@ public class DataNode extends Configured
         LOG.warn(dnRegistration + ":Failed to transfer " + b + " to " + targets[0].getName()
         LOG.warn(dnRegistration + ":Failed to transfer " + b + " to " + targets[0].getName()
             + " got " + StringUtils.stringifyException(ie));
             + " got " + StringUtils.stringifyException(ie));
         // check if there are any disk problem
         // check if there are any disk problem
-        datanode.checkDiskError();
-        
+        try{
+          checkDiskError(ie);
+        } catch(IOException e) {
+          LOG.warn("DataNode.checkDiskError failed in run() with: ", e);
+        }        
       } finally {
       } finally {
         xmitsInProgress.getAndDecrement();
         xmitsInProgress.getAndDecrement();
         IOUtils.closeStream(blockSender);
         IOUtils.closeStream(blockSender);