svn merge -c 1569368. merging from trunk to branch-2 to fix:HDFS-5780. TestRBWBlockInvalidation times out intemittently.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1569369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2014-02-18 14:55:19 +00:00
parent 1ccccb8534
commit 9da50ec5e6
2 changed files with 19 additions and 15 deletions

View File

@ -180,6 +180,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5942. Fix javadoc in OfflineImageViewer. (Akira Ajisaka via cnauroth)
HDFS-5780. TestRBWBlockInvalidation times out intemittently. (Mit Desai
via kihwal)
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

View File

@ -66,7 +66,7 @@ public class TestRBWBlockInvalidation {
* datanode, namenode should ask to invalidate that corrupted block and
* schedule replication for one more replica for that under replicated block.
*/
@Test(timeout=60000)
@Test(timeout=600000)
public void testBlockInvalidationWhenRBWReplicaMissedInDN()
throws IOException, InterruptedException {
// This test cannot pass on Windows due to file locking enforcement. It will
@ -75,7 +75,7 @@ public class TestRBWBlockInvalidation {
Configuration conf = new HdfsConfiguration();
conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 2);
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 100);
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 300);
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)
@ -105,22 +105,23 @@ public class TestRBWBlockInvalidation {
out.close();
// Check datanode has reported the corrupt block.
int corruptReplicas = 0;
int liveReplicas = 0;
while (true) {
if ((corruptReplicas = countReplicas(namesystem, blk).corruptReplicas()) > 0) {
if ((liveReplicas = countReplicas(namesystem, blk).liveReplicas()) < 2) {
// This confirms we have a corrupt replica
LOG.info("Live Replicas after corruption: " + liveReplicas);
break;
}
Thread.sleep(100);
}
assertEquals("There should be 1 replica in the corruptReplicasMap", 1,
corruptReplicas);
assertEquals("There should be less than 2 replicas in the "
+ "liveReplicasMap", 1, liveReplicas);
// Check the block has got replicated to another datanode.
blk = DFSTestUtil.getFirstBlock(fs, testPath);
int liveReplicas = 0;
while (true) {
if ((liveReplicas = countReplicas(namesystem, blk).liveReplicas()) > 1) {
if ((liveReplicas =
countReplicas(namesystem, blk).liveReplicas()) > 1) {
//Wait till the live replica count becomes equal to Replication Factor
LOG.info("Live Replicas after Rereplication: " + liveReplicas);
break;
}
Thread.sleep(100);
@ -128,9 +129,9 @@ public class TestRBWBlockInvalidation {
assertEquals("There should be two live replicas", 2,
liveReplicas);
// sleep for 1 second, so that by this time datanode reports the corrupt
// sleep for 2 seconds, so that by this time datanode reports the corrupt
// block after a live replica of block got replicated.
Thread.sleep(1000);
Thread.sleep(2000);
// Check that there is no corrupt block in the corruptReplicasMap.
assertEquals("There should not be any replica in the corruptReplicasMap",