You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/04/24 07:14:59 UTC

svn commit: r1471253 - /hbase/branches/0.94/bin/graceful_stop.sh

Author: larsh
Date: Wed Apr 24 05:14:59 2013
New Revision: 1471253

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

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

Modified: hbase/branches/0.94/bin/graceful_stop.sh
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/bin/graceful_stop.sh?rev=1471253&r1=1471252&r2=1471253&view=diff
==============================================================================
--- hbase/branches/0.94/bin/graceful_stop.sh (original)
+++ hbase/branches/0.94/bin/graceful_stop.sh Wed Apr 24 05:14:59 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