You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2016/07/11 23:48:03 UTC

[10/50] [abbrv] hbase git commit: HBASE-16044 Fix 'hbase shell' output parsing in graceful_stop.sh

HBASE-16044 Fix 'hbase shell' output parsing in graceful_stop.sh

Change-Id: I94b2f665105837d31281be66d620b6152c3bc9d1


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a396ae77
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a396ae77
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a396ae77

Branch: refs/heads/HBASE-14850
Commit: a396ae773a0f7dbcd6f54fc8133b7a9dc30d8431
Parents: 3b5fbf8
Author: Apekshit Sharma <ap...@apache.org>
Authored: Tue Jun 28 16:55:09 2016 -0700
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Mon Jul 11 11:28:33 2016 -0700

----------------------------------------------------------------------
 bin/graceful_stop.sh                                         | 2 +-
 bin/rolling-restart.sh                                       | 2 +-
 hbase-shell/src/main/ruby/shell/commands/balance_switch.rb   | 4 +++-
 hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb | 4 +++-
 4 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a396ae77/bin/graceful_stop.sh
----------------------------------------------------------------------
diff --git a/bin/graceful_stop.sh b/bin/graceful_stop.sh
index 8d08cc9..89e3dd9 100755
--- a/bin/graceful_stop.sh
+++ b/bin/graceful_stop.sh
@@ -106,7 +106,7 @@ if [ "$nob" == "true"  ]; then
   HBASE_BALANCER_STATE=false
 else
   log "Disabling load balancer"
-  HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell | tail -3 | head -1)
+  HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | tail -1)
   log "Previous balancer state was $HBASE_BALANCER_STATE"
 fi
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a396ae77/bin/rolling-restart.sh
----------------------------------------------------------------------
diff --git a/bin/rolling-restart.sh b/bin/rolling-restart.sh
index 530b76b..9ac4d64 100755
--- a/bin/rolling-restart.sh
+++ b/bin/rolling-restart.sh
@@ -189,7 +189,7 @@ else
     zkrs="$zparent/$zkrs"
     online_regionservers=`$bin/hbase zkcli ls $zkrs 2>&1 | tail -1 | sed "s/\[//" | sed "s/\]//"`
     echo "Disabling load balancer"
-    HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell | tail -3 | head -1)
+    HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | tail -1)
     echo "Previous balancer state was $HBASE_BALANCER_STATE"
 
     for rs in $online_regionservers

http://git-wip-us.apache.org/repos/asf/hbase/blob/a396ae77/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
index 107d267..4076cf6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
@@ -31,7 +31,9 @@ EOF
       end
 
       def command(enableDisable)
-        formatter.row([admin.balance_switch(enableDisable)? "true" : "false"])
+        prev_state = admin.balance_switch(enableDisable)? "true" : "false"
+        formatter.row(["Previous balancer state : #{prev_state}"])
+        prev_state
       end
     end
   end

http://git-wip-us.apache.org/repos/asf/hbase/blob/a396ae77/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
index 6a75ab5..c3d7a2b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
@@ -30,7 +30,9 @@ EOF
       end
 
       def command()
-        formatter.row([admin.balancer_enabled?.to_s])
+        state = admin.balancer_enabled?
+        formatter.row([state.to_s])
+        state
       end
     end
   end