From d9198b2d1bcd1a269ba929ad03420dc58b0fcb81 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Wed, 29 Jan 2020 11:07:50 -0600 Subject: [PATCH] HDFS-15146. TestBalancerRPCDelay.testBalancerRPCDelay fails intermittently. Contributed by Ahmed Hussein. --- .../apache/hadoop/hdfs/server/balancer/TestBalancer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java index c8456b127b0..830dc0ed809 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java @@ -844,6 +844,7 @@ public class TestBalancer { cluster.startDataNodes(conf, 1, true, null, new String[]{newRack}, null,new long[]{newCapacity}); totalCapacity += newCapacity; + cluster.triggerHeartbeats(); } else { //if running a test with "include list", include original nodes as well if (nodes.getNumberofIncludeNodes()>0) { @@ -860,11 +861,13 @@ public class TestBalancer { if (nodes.getNames() != null) { cluster.startDataNodes(conf, nodes.getNumberofNewNodes(), true, null, newRacks, nodes.getNames(), newCapacities); - totalCapacity += newCapacity*nodes.getNumberofNewNodes(); + cluster.triggerHeartbeats(); + totalCapacity += newCapacity * nodes.getNumberofNewNodes(); } else { // host names are not specified cluster.startDataNodes(conf, nodes.getNumberofNewNodes(), true, null, newRacks, null, newCapacities); - totalCapacity += newCapacity*nodes.getNumberofNewNodes(); + cluster.triggerHeartbeats(); + totalCapacity += newCapacity * nodes.getNumberofNewNodes(); //populate the include nodes if (nodes.getNumberofIncludeNodes() > 0) { int totalNodes = cluster.getDataNodes().size(); @@ -1781,6 +1784,7 @@ public class TestBalancer { // start up an empty node with the same capacity and on the same rack cluster.startDataNodes(conf, 1, true, null, new String[] { newRack }, new long[] { newCapacity }); + cluster.triggerHeartbeats(); // Case1: Simulate first balancer by creating 'balancer.id' file. It // will keep this file until the balancing operation is completed.