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
This commit is contained in:
Zhihong Yu 2013-04-22 18:32:03 +00:00
parent 87023082bd
commit d995e62b56
1 changed files with 8 additions and 2 deletions

View File

@ -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