HDFS-5540. Fix intermittent failure in TestBlocksWithNotEnoughRacks. (Binglin Chang via junping_du)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1552256 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Junping Du 2013-12-19 09:21:19 +00:00
parent d4e1081566
commit 42e7446add
2 changed files with 11 additions and 2 deletions

View File

@ -757,6 +757,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5663 make the retry time and interval value configurable in openInfo()
(Liang Xie via stack)
HDFS-5540. Fix intermittent failure in TestBlocksWithNotEnoughRacks.
(Binglin Chang via junping_du)
OPTIMIZATIONS
HDFS-5239. Allow FSNamesystem lock fairness to be configurable (daryn)

View File

@ -347,9 +347,15 @@ public class DFSTestUtil {
// Swallow exceptions
}
System.out.println("Waiting for "+corruptRepls+" corrupt replicas");
repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock());
count++;
Thread.sleep(1000);
// check more often so corrupt block reports are not easily missed
for (int i = 0; i < 10; i++) {
repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock());
Thread.sleep(100);
if (repls == corruptRepls) {
break;
}
}
}
if (count == ATTEMPTS) {
throw new TimeoutException("Timed out waiting for corrupt replicas."