[ 
https://issues.apache.org/jira/browse/HBASE-16044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15354089#comment-15354089
 ] 

Appy commented on HBASE-16044:
------------------------------

Reverted those changes from branch-1.
Submitted patch to fix this issue in master.

Following output shows difference between interactive/non-interactive for a 
simple command like balance_switch.
Interactive
{noformat}
hbase(main):003:0> balance_switch true
Previous balancer state : true
Took 0.0210 seconds
hbase(main):004:0> balance_switch false
Previous balancer state : true
Took 0.0130 seconds
{noformat}


Non-interactive output. Note the last line returning raw (unformatted) output 
which in this case is simple true/false string.
{noformat}
~/apache/hbase  (HBASE-16044) → echo "balance_switch true" | ./bin/hbase shell 
-n
2016-06-28 18:23:12,930 WARN  [main] util.NativeCodeLoader: Unable to load 
native-hadoop library for your platform... using builtin-java classes where 
applicable
Previous balancer state : false
Took 0.3890 seconds
false
~/apache/hbase  (HBASE-16044) → echo "balance_switch true" | ./bin/hbase shell 
-n
2016-06-28 18:23:22,528 WARN  [main] util.NativeCodeLoader: Unable to load 
native-hadoop library for your platform... using builtin-java classes where 
applicable
Previous balancer state : true
Took 0.3830 seconds
true
{noformat}

> Fix 'hbase shell' output parsing in graceful_stop.sh
> ----------------------------------------------------
>
>                 Key: HBASE-16044
>                 URL: https://issues.apache.org/jira/browse/HBASE-16044
>             Project: HBase
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 2.0.0
>            Reporter: Samir Ahmic
>            Assignee: Samir Ahmic
>            Priority: Critical
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16044.master.001.patch
>
>
> In some of our bash scripts we are piping command in hbase shell and then 
> parsing response to define variables.  Since 'hbase shell' output format is 
> changed we are picking wrong values from output Here is example form 
> gracful_stop.sh:
> {code}
> HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config 
> "${HBASE_CONF_DIR}" shell | tail -3 | head -1)
> {code}
> this will return "balance_switch true" instead of previous balancer  state.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to