HDFS-3266. DFSTestUtil#waitCorruptReplicas doesn't sleep between checks. Contributed by Madhukara Phatak.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1346192 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-06-04 23:06:19 +00:00
parent 119a8c7b15
commit a4b1793df0
2 changed files with 5 additions and 1 deletions

View File

@ -304,6 +304,9 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3501. Checkpointing with security enabled will stop working HDFS-3501. Checkpointing with security enabled will stop working
after ticket lifetime expires. (atm via eli) after ticket lifetime expires. (atm via eli)
HDFS-3266. DFSTestUtil#waitCorruptReplicas doesn't sleep between checks.
(Madhukara Phatak via atm)
Release 2.0.0-alpha - 05-23-2012 Release 2.0.0-alpha - 05-23-2012
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -323,7 +323,7 @@ public static void waitForReplication(MiniDFSCluster cluster, ExtendedBlock b,
*/ */
public static void waitCorruptReplicas(FileSystem fs, FSNamesystem ns, public static void waitCorruptReplicas(FileSystem fs, FSNamesystem ns,
Path file, ExtendedBlock b, int corruptRepls) Path file, ExtendedBlock b, int corruptRepls)
throws IOException, TimeoutException { throws IOException, TimeoutException, InterruptedException {
int count = 0; int count = 0;
final int ATTEMPTS = 50; final int ATTEMPTS = 50;
int repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock()); int repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock());
@ -337,6 +337,7 @@ public static void waitCorruptReplicas(FileSystem fs, FSNamesystem ns,
System.out.println("Waiting for "+corruptRepls+" corrupt replicas"); System.out.println("Waiting for "+corruptRepls+" corrupt replicas");
repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock()); repls = ns.getBlockManager().numCorruptReplicas(b.getLocalBlock());
count++; count++;
Thread.sleep(1000);
} }
if (count == ATTEMPTS) { if (count == ATTEMPTS) {
throw new TimeoutException("Timed out waiting for corrupt replicas." throw new TimeoutException("Timed out waiting for corrupt replicas."