[ https://issues.apache.org/jira/browse/HBASE-27086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Junegunn Choi resolved HBASE-27086. ----------------------------------- Resolution: Fixed > graceful_stop cannot take previous balancer status by incompatibility of > hbase shell prompt > ------------------------------------------------------------------------------------------- > > Key: HBASE-27086 > URL: https://issues.apache.org/jira/browse/HBASE-27086 > Project: HBase > Issue Type: Bug > Affects Versions: 2.5.0, 2.6.0, 2.4.10, 2.4.12 > Reporter: Shinya Yoshida > Assignee: Shinya Yoshida > Priority: Major > > {code:java} > graceful_stop.sh --failfast $(hostname -f) > 2022-06-03T20:04:34 Set failfast, will exit immediately if any command exits > with non-zero status > 2022-06-03T20:04:34 Disabling load balancer > 2022-06-03T20:04:42 Previous balancer state was hbase:002:0> > 2022-06-03T20:04:42 Unloading myregionserver.example.com region(s) > 2022-06-03T20:04:46 Unloaded myregionserver.example.com region(s) > 2022-06-03T20:04:46 Stopping regionserver on myregionserver.example.com > running regionserver, logging to /var/log/hbase/hbase-hbase-regionserver.out > stopping regionserver. > 2022-06-03T20:04:47 Restoring balancer state to hbase:002:0> > {code} > You can see wrong previous balancer state > {code:java} > 2022-06-03T20:04:42 Previous balancer state was hbase:002:0> > {code} > this should be either of true or false, but it's "hbase:002:0>" > This is because of the incompatibility of hbase shell prompt behavior. > graceful_stop perform `echo 'balance_switch false' | "$bin"/hbase --config > "${HBASE_CONF_DIR}" shell -n | tail -1` > https://github.com/apache/hbase/blob/d57159f31cb7be4d9ced0d7b95e2c78c43d160a1/bin/graceful_stop.sh#L118 > However, hbase shell now always set prompt mode to CUSTOM. > https://github.com/apache/hbase/blob/d57159f31cb7be4d9ced0d7b95e2c78c43d160a1/hbase-shell/src/main/ruby/jar-bootstrap.rb#L206 > (this breaking change is introduced in > https://github.com/apache/hbase/pull/4018 in hbase2.4.10, > https://issues.apache.org/jira/browse/HBASE-26469) > So the prompt is always shown even when `hbase shell -n` or just piping stdin. > {code:java} > $ echo "balance_switch false" | 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/2.0/book.html#shell > Version 2.4.12-xxx > Took 0.0022 seconds > > > hbase:001:0> balance_switch false > Previous balancer state : false > > > Took 0.4308 seconds > > > => false > hbase:002:0> > $ echo "balance_switch false" | hbase shell -n > hbase:001:0> balance_switch false > Previous balancer state : false > > > Took 0.5207 seconds > > > => false > hbase:002:0> > {code} > This is incompatible from old version. > {code:java} > hbase 1.4.x version: > $ echo "balance_switch false" | hbase shell > HBase Shell > Use "help" to get list of supported commands. > Use "exit" to quit this interactive shell. > Version 1.4.13-xxx > balance_switch false > false > > > > > 0 row(s) in 0.3310 seconds > $ echo "balance_switch false" | hbase shell -n > false > > > > > 0 row(s) in 0.4240 seconds > nil > {code} > {code:java} > hbase-2.4.9 > $ echo "balance_switch false" | bin/hbase shell -n > Previous balancer state : false > > > > > Took 0.4340 seconds > > > > > false > {code} > (TODO check old hbase-2 case) > In old version, :NULL is used for prompt_mode > {code:java} > $ echo "irb_context.prompt_mode" | hbase shell > HBase Shell > Use "help" to get list of supported commands. > Use "exit" to quit this interactive shell. > Version 1.4.13-xxx > irb_context.prompt_mode > :NULL > {code} > But it's now :CUSTOM > {code:java} > $ echo "irb_context.prompt_mode" | 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/2.0/book.html#shell > Version 2.4.12-xxx > Took 0.0028 seconds > > > hbase:001:0> irb_context.prompt_mode > => :CUSTOM > hbase:002:0> > {code} > We should keep using NULL prompt_mode for such case respecting previous > behavior? -- This message was sent by Atlassian Jira (v8.20.10#820010)