From ba9025c7cd8303dadaa792b6372a877414564cd7 Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Sat, 22 Feb 2020 14:27:26 +0530 Subject: [PATCH] HDFS-15182. TestBlockManager#testOneOfTwoRacksDecommissioned() fail in trunk. Contributed by Lisheng Sun. --- .../hadoop/hdfs/server/blockmanagement/TestBlockManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java index 237cacc7c97..241f3af1b8e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java @@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Lists; import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies; +import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.slf4j.LoggerFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CreateFlag; @@ -342,6 +343,8 @@ public class TestBlockManager { @Test public void testOneOfTwoRacksDecommissioned() throws Exception { addNodes(nodes); + NameNode.initMetrics(new Configuration(), + HdfsServerConstants.NamenodeRole.NAMENODE); for (int i = 0; i < NUM_TEST_ITERS; i++) { doTestOneOfTwoRacksDecommissioned(i); }