-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-27086 Fix graceful_stop cannot take previous balancer status by incompatibility of hbase shell prompt #4490
base: master
Are you sure you want to change the base?
Conversation
… incompatibility of hbase shell prompt
@@ -203,7 +203,10 @@ def debug? | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -115,7 +115,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 -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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
https://issues.apache.org/jira/browse/HBASE-27086
There're 2 issues
hbase shell
shows prompt always even throughecho "balance_switch false" | hbase shell -n
(noninteractive mode or piped)tail -1
retrieve the empty line. needtail -2 | head -1
to retrieve true/false for previous balancer statusNeed this patch in branch-2.4, 2.5, 2, 3, master