From 7dd869c2a98998aea457e522ad4b7c5403312482 Mon Sep 17 00:00:00 2001 From: Konstantin Shvachko Date: Sun, 23 Oct 2011 00:35:55 +0000 Subject: [PATCH] HDFS-2491. TestBalancer can fail when datanode utilization and avgUtilization is exactly same. Contributed by Uma Maheswara Rao G. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1187837 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/hdfs/server/balancer/Balancer.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index bcb39f3dea..b32d67188c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1762,6 +1762,9 @@ Release 0.22.0 - Unreleased HDFS-2012. Balancer incorrectly treats nodes whose utilization equals avgUtilization. (Uma Maheswara Rao G via shv) + HDFS-2491. TestBalancer can fail when datanode utilization and + avgUtilization is exactly same. (Uma Maheswara Rao G via shv) + Release 0.21.1 - Unreleased HDFS-1466. TestFcHdfsSymlink relies on /tmp/test not existing. (eli) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java index cc233447c2..b8b6b38509 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java @@ -823,7 +823,7 @@ private long initNodes(DatanodeInfo[] datanodes) { cluster.add(datanode); BalancerDatanode datanodeS; final double avg = policy.getAvgUtilization(); - if (policy.getUtilization(datanode) > avg) { + if (policy.getUtilization(datanode) >= avg) { datanodeS = new Source(datanode, policy, threshold); if (isAboveAvgUtilized(datanodeS)) { this.aboveAvgUtilizedDatanodes.add((Source)datanodeS);