You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2013/04/22 20:32:03 UTC
svn commit: r1470657 - /hbase/trunk/bin/graceful_stop.sh
Author: tedyu
Date: Mon Apr 22 18:32:03 2013
New Revision: 1470657
URL: http://svn.apache.org/r1470657
Log:
HBASE-8379 bin/graceful_stop.sh does not return the balancer to original state (Jean-Marc)
Modified:
hbase/trunk/bin/graceful_stop.sh
Modified: hbase/trunk/bin/graceful_stop.sh
URL: http://svn.apache.org/viewvc/hbase/trunk/bin/graceful_stop.sh?rev=1470657&r1=1470656&r2=1470657&view=diff
==============================================================================
--- hbase/trunk/bin/graceful_stop.sh (original)
+++ hbase/trunk/bin/graceful_stop.sh Mon Apr 22 18:32:03 2013
@@ -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