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:33:01 UTC

svn commit: r1470659 - /hbase/branches/0.95/bin/graceful_stop.sh

Author: tedyu
Date: Mon Apr 22 18:33:01 2013
New Revision: 1470659

URL: http://svn.apache.org/r1470659
Log:
HBASE-8379 bin/graceful_stop.sh does not return the balancer to original state (Jean-Marc)


Modified:
    hbase/branches/0.95/bin/graceful_stop.sh

Modified: hbase/branches/0.95/bin/graceful_stop.sh
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/bin/graceful_stop.sh?rev=1470659&r1=1470658&r2=1470659&view=diff
==============================================================================
--- hbase/branches/0.95/bin/graceful_stop.sh (original)
+++ hbase/branches/0.95/bin/graceful_stop.sh Mon Apr 22 18:33:01 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