浏览代码

Merging change r955380 for HDFS-561 from 0.20-append branch to 0.20-security

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1160426 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 14 年之前
父节点
当前提交
8fc4fc78e0

+ 3 - 0
CHANGES.txt

@@ -39,6 +39,9 @@ Release 0.20.205.0 - unreleased
 
     HDFS-2259. DN web-UI doesn't work with paths that contain html. (eli)
 
+    HDFS-561. Fix write pipeline READ_TIMEOUT.
+    (Todd Lipcon via dhruba)
+
   IMPROVEMENTS
 
     MAPREDUCE-2187. Reporter sends progress during sort/merge. (Anupam Seth via

+ 3 - 1
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

@@ -719,7 +719,9 @@ public class DFSClient implements FSConstants, java.io.Closeable {
       final DatanodeInfo[] datanodes = lb.getLocations();
       
       //try each datanode location of the block
-      final int timeout = 3000 * datanodes.length + socketTimeout;
+      final int timeout = (socketTimeout > 0) ? (socketTimeout + 
+        HdfsConstants.READ_TIMEOUT_EXTENSION * datanodes.length) : 0;
+     
       boolean done = false;
       for(int j = 0; !done && j < datanodes.length; j++) {
         //connect to a datanode

+ 1 - 0
src/hdfs/org/apache/hadoop/hdfs/server/common/HdfsConstants.java

@@ -48,6 +48,7 @@ public interface HdfsConstants {
 
   // Timeouts for communicating with DataNode for streaming writes/reads
   public static int READ_TIMEOUT = 60 * 1000;
+  public static int READ_TIMEOUT_EXTENSION = 3 * 1000;
   public static int WRITE_TIMEOUT = 8 * 60 * 1000;
   public static int WRITE_TIMEOUT_EXTENSION = 5 * 1000; //for write pipeline
 

+ 2 - 1
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java

@@ -312,7 +312,8 @@ class DataXceiver implements Runnable, FSConstants {
         mirrorTarget = NetUtils.createSocketAddr(mirrorNode);
         mirrorSock = datanode.newSocket();
         try {
-          int timeoutValue = numTargets * datanode.socketTimeout;
+          int timeoutValue = datanode.socketTimeout +
+                             (HdfsConstants.READ_TIMEOUT_EXTENSION * numTargets);
           int writeTimeout = datanode.socketWriteTimeout + 
                              (HdfsConstants.WRITE_TIMEOUT_EXTENSION * numTargets);
           NetUtils.connect(mirrorSock, mirrorTarget, timeoutValue);