소스 검색

HDFS-14880. Correct the sequence of statistics & exit message in balencer. Contributed by Renukaprasad C.

Ayush Saxena 5 년 전
부모
커밋
dcf55838ae
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java

+ 3 - 1
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<DatanodeStorageReport> 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);