From dc72ed7218b47001c34af898157c8538ffb0caec Mon Sep 17 00:00:00 2001 From: Vinayakumar B Date: Mon, 5 Oct 2015 13:22:44 +0530 Subject: [PATCH] HDFS-9151. Mover should print the exit status/reason on console like balancer tool. (Contributed by Surendra singh lilhore) (cherry picked from commit 0faa4efa3dd74de9cc39584bf6e88cfbf3e9a045) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/mover/Mover.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 3484c7afe3f..06dac2fbb3d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1145,6 +1145,9 @@ Release 2.8.0 - UNRELEASED HADOOP-11098. [JDK8] Max Non Heap Memory default changed between JDK7 and 8 (ozawa). + HDFS-9151. Mover should print the exit status/reason on console like + balancer tool. (Surendra singh lilhore via vinayakumarb) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/mover/Mover.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/mover/Mover.java index afacebb51f8..374ad5eb892 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/mover/Mover.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/mover/Mover.java @@ -571,12 +571,23 @@ static int run(Map> namenodes, Configuration conf) IOUtils.cleanup(LOG, nnc); iter.remove(); } else if (r != ExitStatus.IN_PROGRESS) { + if (r == ExitStatus.NO_MOVE_PROGRESS) { + System.err.println("Failed to move some blocks after " + + m.retryMaxAttempts + " retries. Exiting..."); + } else if (r == ExitStatus.NO_MOVE_BLOCK) { + System.err.println("Some blocks can't be moved. Exiting..."); + } else { + System.err.println("Mover failed. Exiting with status " + r + + "... "); + } // must be an error statue, return return r.getExitCode(); } } Thread.sleep(sleeptime); } + System.out.println("Mover Successful: all blocks satisfy" + + " the specified storage policy. Exiting..."); return ExitStatus.SUCCESS.getExitCode(); } finally { for (NameNodeConnector nnc : connectors) { @@ -781,4 +792,4 @@ public static void main(String[] args) { System.exit(-1); } } -} \ No newline at end of file +}