HDFS-3919. MiniDFSCluster:waitClusterUp can hang forever. Contributed by Andy Isaacson

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1383759 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-09-12 04:21:31 +00:00
parent 414abe6918
commit f0c3ed79dd
2 changed files with 8 additions and 1 deletions

View File

@ -230,6 +230,9 @@ Release 2.0.3-alpha - Unreleased
BUG FIXES BUG FIXES
HDFS-3919. MiniDFSCluster:waitClusterUp can hang forever.
(Andy Isaacson via eli)
Release 2.0.2-alpha - 2012-09-07 Release 2.0.2-alpha - 2012-09-07
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -918,7 +918,8 @@ public class MiniDFSCluster {
/** /**
* wait for the cluster to get out of safemode. * wait for the cluster to get out of safemode.
*/ */
public void waitClusterUp() { public void waitClusterUp() throws IOException {
int i = 0;
if (numDataNodes > 0) { if (numDataNodes > 0) {
while (!isClusterUp()) { while (!isClusterUp()) {
try { try {
@ -926,6 +927,9 @@ public class MiniDFSCluster {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
if (++i > 10) {
throw new IOException("Timed out waiting for Mini HDFS Cluster to start");
}
} }
} }
} }