From dcf55838ae41aecfa8a7b37d9b95478ce6acf0a7 Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Wed, 6 Nov 2019 21:45:03 +0530 Subject: [PATCH] HDFS-14880. Correct the sequence of statistics & exit message in balencer. Contributed by Renukaprasad C. --- .../java/org/apache/hadoop/hdfs/server/balancer/Balancer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 684b2d9b51d..e8b49718fed 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 @@ -626,7 +626,6 @@ public class Balancer { final List reports = dispatcher.init(); final long bytesLeftToMove = init(reports); if (bytesLeftToMove == 0) { - System.out.println("The cluster is balanced. Exiting..."); return newResult(ExitStatus.SUCCESS, bytesLeftToMove, 0); } else { LOG.info( "Need to move "+ StringUtils.byteDesc(bytesLeftToMove) @@ -735,6 +734,9 @@ public class Balancer { } else { LOG.info("Skipping blockpool " + nnc.getBlockpoolID()); } + if (done) { + System.out.println("The cluster is balanced. Exiting..."); + } } if (!done) { Thread.sleep(sleeptime);