HDFS-1923. In TestFiDataTransferProtocol2, reduce random sleep time period and increase the number of datanodes.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@1132698 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 78d7ea2..54a1a5a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -439,10 +439,10 @@
     HDFS-1573. Add useful tracing information to Lease Renewer thread names
     (todd)
 
-    HDFS-1939.  In ivy.xml, test conf should not extend common conf.
+    HDFS-1939. In ivy.xml, test conf should not extend common conf.
     (Eric Yang via szetszwo)
 
-    HDFS-1332.  Include more information in exceptions and debug messages
+    HDFS-1332  Include more information in exceptions and debug messages
     when BlockPlacementPolicy cannot be satisfied.  (Ted Yu via szetszwo)
 
     HDFS-1958. Confirmation should be more lenient of user input when
@@ -451,12 +451,12 @@
     HDFS-1905. Improve namenode -format command by not making -clusterId
     parameter mandatory. (Bharath Mundlapudi via suresh)
 
-    HDFS-1877.  Add a new test for concurrent read and write.  (CW Chung
+    HDFS-1877. Add a new test for concurrent read and write.  (CW Chung
     via szetszwo)
 
     HDFS-1959. Better error message for missing namenode directory. (eli)
 
-    HDFS-1996.  ivy: hdfs test jar should be independent to common test jar.
+    HDFS-1996. ivy: hdfs test jar should be independent to common test jar.
     (Eric Yang via szetszwo)
 
     HDFS-1812. TestHDFSCLI should clean up cluster in teardown method.
@@ -471,18 +471,18 @@
     HDFS-1636. If dfs.name.dir points to an empty dir, namenode format
     shouldn't require confirmation. (Harsh J Chouraria via todd)
 
-    HDFS-1966.  Encapsulate individual DataTransferProtocol op headers.
+    HDFS-1966. Encapsulate individual DataTransferProtocol op headers.
     (szetszwo)
 
-    HDFS-2024.  Format TestWriteRead source codes.  (CW Chung via szetszwo)
+    HDFS-2024. Format TestWriteRead source codes.  (CW Chung via szetszwo)
 
-    HDFS-1968.  Enhance TestWriteRead to support position/sequential read,
+    HDFS-1968. Enhance TestWriteRead to support position/sequential read,
     append, truncate and verbose options.  (CW Chung via szetszwo)
 
     HDFS-1986. Add option to get http/https address from 
     DFSUtil#getInfoServer(). (Tanping via suresh)
 
-    HDFS-2029.  In TestWriteRead, check visible length immediately after
+    HDFS-2029. In TestWriteRead, check visible length immediately after
     openning the file and fix code style.  (John George via szetszwo)
 
   OPTIMIZATIONS
@@ -687,6 +687,9 @@
     HDFS-1907. Fix position read for reading still-being-written file in
     DFSInputStream.  (John George via szetszwo)
 
+    HDFS-1923. In TestFiDataTransferProtocol2, reduce random sleep time period
+    and increase the number of datanodes.  (szetszwo)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES
diff --git a/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol2.java b/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol2.java
index d2868b7..8a25b08 100644
--- a/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol2.java
+++ b/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol2.java
@@ -50,6 +50,8 @@
   static final int MIN_N_PACKET = 3;
   static final int MAX_N_PACKET = 10;
 
+  static final int MAX_SLEEP = 1000;
+
   static final Configuration conf = new Configuration();
   static {
     conf.setInt(DFSConfigKeys.DFS_DATANODE_HANDLER_COUNT_KEY, 1);
@@ -89,7 +91,7 @@
         + ", lastPacketSize=" + lastPacketSize);
 
     final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf
-        ).numDataNodes(REPLICATION + 1).build();
+        ).numDataNodes(REPLICATION + 2).build();
     final FileSystem dfs = cluster.getFileSystem();
     try {
       final Path p = new Path("/" + methodName + "/foo");
@@ -128,12 +130,11 @@
   private void runTest17_19(String methodName, int dnIndex)
       throws IOException {
     FiTestUtil.LOG.info("Running " + methodName + " ...");
-    final int maxSleep = 3000;
     final DataTransferTest t = (DataTransferTest) DataTransferTestUtil
         .initTest();
-    initSlowDatanodeTest(t, new SleepAction(methodName, 0, 0, maxSleep));
-    initSlowDatanodeTest(t, new SleepAction(methodName, 1, 0, maxSleep));
-    initSlowDatanodeTest(t, new SleepAction(methodName, 2, 0, maxSleep));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 0, 0, MAX_SLEEP));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 1, 0, MAX_SLEEP));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 2, 0, MAX_SLEEP));
     t.fiCallWritePacketToDisk.set(new CountdownDoosAction(methodName, dnIndex, 3));
     t.fiPipelineErrorAfterInit.set(new VerificationAction(methodName, dnIndex));
     writeSeveralPackets(methodName);
@@ -142,12 +143,11 @@
 
   private void runTest29_30(String methodName, int dnIndex) throws IOException {
     FiTestUtil.LOG.info("Running " + methodName + " ...");
-    final int maxSleep = 3000;
     final DataTransferTest t = (DataTransferTest) DataTransferTestUtil
         .initTest();
-    initSlowDatanodeTest(t, new SleepAction(methodName, 0, 0, maxSleep));
-    initSlowDatanodeTest(t, new SleepAction(methodName, 1, 0, maxSleep));
-    initSlowDatanodeTest(t, new SleepAction(methodName, 2, 0, maxSleep));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 0, 0, MAX_SLEEP));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 1, 0, MAX_SLEEP));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 2, 0, MAX_SLEEP));
     t.fiAfterDownstreamStatusRead.set(new CountdownOomAction(methodName, dnIndex, 3));
     t.fiPipelineErrorAfterInit.set(new VerificationAction(methodName, dnIndex));
     writeSeveralPackets(methodName);
@@ -209,7 +209,7 @@
     FiTestUtil.LOG.info("Running " + methodName + " ...");
     final DataTransferTest t = (DataTransferTest) DataTransferTestUtil
         .initTest();
-    initSlowDatanodeTest(t, new SleepAction(methodName, 0, 3000));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 0, MAX_SLEEP));
     writeSeveralPackets(methodName);
   }
 
@@ -223,7 +223,7 @@
     FiTestUtil.LOG.info("Running " + methodName + " ...");
     final DataTransferTest t = (DataTransferTest) DataTransferTestUtil
         .initTest();
-    initSlowDatanodeTest(t, new SleepAction(methodName, 1, 3000));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 1, MAX_SLEEP));
     writeSeveralPackets(methodName);
   }
   
@@ -237,7 +237,7 @@
     FiTestUtil.LOG.info("Running " + methodName + " ...");
     final DataTransferTest t = (DataTransferTest) DataTransferTestUtil
         .initTest();
-    initSlowDatanodeTest(t, new SleepAction(methodName, 2, 3000));
+    initSlowDatanodeTest(t, new SleepAction(methodName, 2, MAX_SLEEP));
     writeSeveralPackets(methodName);
   }