From d995e62b56c73c3ef1272730c2211b367f43029b Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Mon, 22 Apr 2013 18:32:03 +0000 Subject: [PATCH] HBASE-8379 bin/graceful_stop.sh does not return the balancer to original state (Jean-Marc) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1470657 13f79535-47bb-0310-9956-ffa450edef68 --- bin/graceful_stop.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/graceful_stop.sh b/bin/graceful_stop.sh index beac4b15b14..1255fe8e00a 100755 --- a/bin/graceful_stop.sh +++ b/bin/graceful_stop.sh @@ -69,8 +69,9 @@ fi hostname=$1 filename="/tmp/$hostname" # Run the region mover script. -echo "Disabling balancer!" -echo 'balance_switch false' | "$bin"/hbase --config ${HBASE_CONF_DIR} shell +echo "Disabling balancer! (if required)" +HBASE_BALANCER_STATE=`echo 'balance_switch false' | "$bin"/hbase --config ${HBASE_CONF_DIR} shell | tail -3 | head -1` +echo "Previous balancer state was $HBASE_BALANCER_STATE" echo "Unloading $hostname region(s)" HBASE_NOEXEC=true "$bin"/hbase --config ${HBASE_CONF_DIR} org.jruby.Main "$bin"/region_mover.rb --file=$filename $debug unload $hostname echo "Unloaded $hostname region(s)" @@ -100,5 +101,10 @@ if [ "$restart" != "" ]; then fi fi +if [ $HBASE_BALANCER_STATE != "false" ]; then + echo "Restoring balancer state to " $HBASE_BALANCER_STATE + echo "balance_switch $HBASE_BALANCER_STATE" | "$bin"/hbase --config ${HBASE_CONF_DIR} shell &> /dev/null +fi + # Cleanup tmp files. trap "rm -f "/tmp/$(basename $0).*.tmp" &> /dev/null" EXIT