Uh oh!
There was an error while loading. Please reload this page.
HBASE-27086 Fix graceful_stop cannot take previous balancer status by incompatibility of hbase shell prompt - #4490
HBASE-27086 Fix graceful_stop cannot take previous balancer status by incompatibility of hbase shell prompt#4490bitterfox wants to merge 2 commits into
Conversation
… incompatibility of hbase shell prompt
| IRB.conf[:IRB_NAME] = 'hbase' | ||
| IRB.conf[:AP_NAME] = 'hbase' | ||
| IRB.conf[:PROMPT_MODE] = :CUSTOM | ||
| if IRB.conf[:PROMPT_MODE] != :NULL |
There was a problem hiding this comment.
I'm not sure which is preferred. The behavior in this patch is similar to hbase 1.x hbase shell
if IRB.conf[:PROMPT_MODE] != :NULL: no prompt for pipe or non interaction
$ echo "balance_switch false" | bin/hbase shell
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/book.html#shell
Version 3.0.0-alpha-3-SNAPSHOT, ra712f9fa34ed3ace5ae6bf539c227a110b259a2c, Mon Jun 6 13:59:23 JST 2022
Took 0.0020 seconds balance_switch false
Previous balancer state : false Took 0.9183 seconds false
$ echo "balance_switch false" | bin/hbase shell -n
balance_switch false
Previous balancer state : false Took 0.9745 seconds false
if interactive: no prompt non interaction only (similar behavior as hbase 2.4.9)
$ echo "balance_switch false" | bin/hbase shell
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/book.html#shell
Version 3.0.0-alpha-3-SNAPSHOT, ra712f9fa34ed3ace5ae6bf539c227a110b259a2c, Mon Jun 6 13:59:23 JST 2022
Took 0.0023 seconds hbase:001:0> balance_switch false
Previous balancer state : false Took 1.0975 seconds => false
hbase:002:0> $ echo "balance_switch false" | bin/hbase shell -n
balance_switch false
Previous balancer state : false Took 0.9643 seconds false
Let me know which behavior is preferred
There was a problem hiding this comment.
I'd say skip the prompt only in non-interactive mode. The general position since the introduction of the non-interactive flag is that it ought to be used for any scripted integration.
There was a problem hiding this comment.
Thank you for the suggestion. I see. I updated it to use interactive for condition. we can switch prompt by -n option in any case we want to do so.
| else | ||
| log "Disabling load balancer" | ||
| HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | tail -1) | ||
| HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | tail -2 | head -1) |
There was a problem hiding this comment.
No idea, but empty line is added to the end of output of hbase shell. we need to take the 2nd line from the last
$ echo "balance_switch false" | bin/hbase shell -n | tail -1
$ echo "balance_switch false" | bin/hbase shell -n | tail -2 | head -1
false
Apache-HBase
commented
Jun 6, 2022
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Jun 6, 2022
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Jun 9, 2022
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Jun 9, 2022
🎊 +1 overall
This message was automatically generated. |
junegunn
commented
Jun 16, 2025
Thanks @bitterfox. This bug was later fixed by another PR: #4680 |
https://issues.apache.org/jira/browse/HBASE-27086
There're 2 issues
hbase shellshows prompt always even throughecho "balance_switch false" | hbase shell -n(noninteractive mode or piped)tail -1retrieve the empty line. needtail -2 | head -1to retrieve true/false for previous balancer statusNeed this patch in branch-2.4, 2.5, 2, 3, master