From 9b959f3ee70cfdaf532d72f0bbbd1a4be0be12aa Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Thu, 11 Feb 2016 20:40:03 -0800 Subject: [PATCH] HDFS-9790. HDFS Balancer should exit with a proper message if upgrade is not finalized (Contributed by Xiaobing Zhou) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/hdfs/server/balancer/Balancer.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 73a09d6627a..c0d7113b771 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2739,6 +2739,9 @@ Release 2.8.0 - UNRELEASED HDFS-9788. Incompatible tag renumbering in HeartbeatResponseProto. (wang) + HDFS-9790. HDFS Balancer should exit with a proper message if upgrade is + not finalized. (Xiaobing Zhou via Arpit Agarwal) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES 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 927fb7fbcc9..191e1c3d4f6 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 @@ -586,6 +586,8 @@ public class Balancer { // Should not run the balancer during an unfinalized upgrade, since moved // blocks are not deleted on the source datanode. if (!runDuringUpgrade && nnc.isUpgrading()) { + System.err.println("Balancer exiting as upgrade is not finalized, " + + "please finalize the HDFS upgrade before running the balancer."); return newResult(ExitStatus.UNFINALIZED_UPGRADE, bytesLeftToMove, -1); }