svn merge -c 1456172 Merging from trunk to branch-2 to fix HDFS-3344.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1456176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-03-13 22:00:15 +00:00
parent b4716f96d2
commit 3a4e568e42
2 changed files with 12 additions and 4 deletions

View File

@ -2166,6 +2166,9 @@ Release 0.23.7 - UNRELEASED
HDFS-4577. Webhdfs operations should declare if authentication is required HDFS-4577. Webhdfs operations should declare if authentication is required
(daryn via kihwal) (daryn via kihwal)
HDFS-3344. Unreliable corrupt blocks counting in TestProcessCorruptBlocks
(kihwal)
Release 0.23.6 - UNRELEASED Release 0.23.6 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -158,7 +158,7 @@ public class TestProcessCorruptBlocks {
* (corrupt replica should be removed since number of good * (corrupt replica should be removed since number of good
* replicas (1) is equal to replication factor (1)) * replicas (1) is equal to replication factor (1))
*/ */
@Test @Test(timeout=20000)
public void testWithReplicationFactorAsOne() throws Exception { public void testWithReplicationFactorAsOne() throws Exception {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L); conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L);
@ -183,10 +183,15 @@ public class TestProcessCorruptBlocks {
namesystem.setReplication(fileName.toString(), (short) 1); namesystem.setReplication(fileName.toString(), (short) 1);
// wait for 3 seconds so that all block reports are processed. // wait for 3 seconds so that all block reports are processed.
for (int i = 0; i < 10; i++) {
try { try {
Thread.sleep(3000); Thread.sleep(1000);
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
if (countReplicas(namesystem, block).corruptReplicas() == 0) {
break;
}
}
assertEquals(1, countReplicas(namesystem, block).liveReplicas()); assertEquals(1, countReplicas(namesystem, block).liveReplicas());
assertEquals(0, countReplicas(namesystem, block).corruptReplicas()); assertEquals(0, countReplicas(namesystem, block).corruptReplicas());