hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1489670 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java
Date Tue, 04 Jun 2013 23:20:14 GMT
Author: atm
Date: Tue Jun  4 23:18:58 2013
New Revision: 1489670

URL: http://svn.apache.org/r1489670
Log:
HDFS-4815. TestRBWBlockInvalidation: Double call countReplicas() to fetch corruptReplicas
and liveReplicas is not needed. Contributed by Tian Hong Wang.

Modified:
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1489670&r1=1489669&r2=1489670&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue Jun  4
23:18:58 2013
@@ -342,6 +342,9 @@ Release 2.1.0-beta - UNRELEASED
 
     HDFS-4840. ReplicationMonitor gets NPE during shutdown. (kihwal)
 
+    HDFS-4815. TestRBWBlockInvalidation: Double call countReplicas() to fetch
+    corruptReplicas and liveReplicas is not needed. (Tian Hong Wang via atm)
+
   BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
 
     HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java?rev=1489670&r1=1489669&r2=1489670&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestRBWBlockInvalidation.java
Tue Jun  4 23:18:58 2013
@@ -70,7 +70,7 @@ public class TestRBWBlockInvalidation {
       throws IOException, InterruptedException {
     Configuration conf = new HdfsConfiguration();
     conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 2);
-    conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 300);
+    conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 100);
     conf.setLong(DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEY, 1);
     conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
     MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2)
@@ -101,27 +101,27 @@ public class TestRBWBlockInvalidation {
       out.close();
 
       // Check datanode has reported the corrupt block.
-      boolean isCorruptReported = false;
-      while (!isCorruptReported) {
-        if (countReplicas(namesystem, blk).corruptReplicas() > 0) {
-          isCorruptReported = true;
+      int corruptReplicas = 0;
+      while (true) {
+        if ((corruptReplicas = countReplicas(namesystem, blk).corruptReplicas()) > 0)
{
+          break;
         }
         Thread.sleep(100);
       }
       assertEquals("There should be 1 replica in the corruptReplicasMap", 1,
-          countReplicas(namesystem, blk).corruptReplicas());
+          corruptReplicas);
 
       // Check the block has got replicated to another datanode.
       blk = DFSTestUtil.getFirstBlock(fs, testPath);
-      boolean isReplicated = false;
-      while (!isReplicated) {
-        if (countReplicas(namesystem, blk).liveReplicas() > 1) {
-          isReplicated = true;
+      int liveReplicas = 0;
+      while (true) {
+        if ((liveReplicas = countReplicas(namesystem, blk).liveReplicas()) > 1) {
+          break;
         }
         Thread.sleep(100);
       }
-      assertEquals("There should be two live replicas", 2, countReplicas(
-          namesystem, blk).liveReplicas());
+      assertEquals("There should be two live replicas", 2,
+          liveReplicas);
 
       // sleep for 1 second, so that by this time datanode reports the corrupt
       // block after a live replica of block got replicated.



Mime
View raw message