HDFS-9376. TestSeveralNameNodes fails occasionally. Contributed by Masatake Iwasaki.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/84a81477 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/84a81477 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/84a81477 Branch: refs/heads/yarn-2877 Commit: 84a81477912644290173518d566b586305b85bf7 Parents: 561abb9 Author: cnauroth <cnaur...@apache.org> Authored: Tue Dec 29 14:37:03 2015 -0800 Committer: cnauroth <cnaur...@apache.org> Committed: Tue Dec 29 14:37:03 2015 -0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/84a81477/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 9da92b2..f9b17a8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -400,6 +400,9 @@ Trunk (Unreleased) HDFS-9580. TestComputeInvalidateWork#testDatanodeReRegistration failed due to unexpected number of invalidate blocks. (Wei-Chiu Chuang via zhz) + HDFS-9376. TestSeveralNameNodes fails occasionally. + (Masatake Iwasaki via cnauroth) + BREAKDOWN OF HDFS-7285 SUBTASKS AND RELATED JIRAS HDFS-7347. Configurable erasure coding policy for individual files and http://git-wip-us.apache.org/repos/asf/hadoop/blob/84a81477/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java index bda928f..537c189 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestSeveralNameNodes.java @@ -32,6 +32,7 @@ import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; +import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; import org.apache.hadoop.test.MultithreadedTestUtil.RepeatingTestThread; import org.apache.hadoop.test.MultithreadedTestUtil.TestContext; import org.junit.Test; @@ -57,6 +58,8 @@ public class TestSeveralNameNodes { // setup the harness harness.setNumberOfNameNodes(NUM_NAMENODES); harness.addFailoverThread(TIME_BETWEEN_FAILOVERS); + harness.conf.setInt(HdfsClientConfigKeys.Failover.SLEEPTIME_MAX_KEY, 1000); + harness.conf.setInt(HdfsClientConfigKeys.Failover.MAX_ATTEMPTS_KEY, 128); final MiniDFSCluster cluster = harness.startCluster(); try { @@ -78,7 +81,8 @@ public class TestSeveralNameNodes { // wait for all the writer threads to finish, or that we exceed the time long start = System.currentTimeMillis(); - while ((System.currentTimeMillis() - start) < RUNTIME) { + while ((System.currentTimeMillis() - start) < RUNTIME && + writers.size() > 0) { for (int i = 0; i < writers.size(); i++) { CircularWriter writer = writers.get(i); // remove the writer from the ones to check @@ -176,4 +180,4 @@ public class TestSeveralNameNodes { return new Path(dir, Integer.toString(i)); } } -} \ No newline at end of file +}