diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5aafbe622ac..036609ad4e5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -230,6 +230,9 @@ Release 2.0.3-alpha - Unreleased BUG FIXES + HDFS-3919. MiniDFSCluster:waitClusterUp can hang forever. + (Andy Isaacson via eli) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java index 78483466792..9d9b5c24484 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java @@ -918,7 +918,8 @@ public class MiniDFSCluster { /** * wait for the cluster to get out of safemode. */ - public void waitClusterUp() { + public void waitClusterUp() throws IOException { + int i = 0; if (numDataNodes > 0) { while (!isClusterUp()) { try { @@ -926,6 +927,9 @@ public class MiniDFSCluster { Thread.sleep(1000); } catch (InterruptedException e) { } + if (++i > 10) { + throw new IOException("Timed out waiting for Mini HDFS Cluster to start"); + } } } }