Grigore Lupescu created HBASE-27742:
---------------------------------------

             Summary: Hbase shell non interactive stalls
                 Key: HBASE-27742
                 URL: https://issues.apache.org/jira/browse/HBASE-27742
             Project: HBase
          Issue Type: Bug
          Components: shell
    Affects Versions: 2.4.8
         Environment: This may very well be a general limitation or bug, not 
tied to a specific version
            Reporter: Grigore Lupescu


The following bash shell script invocations may stall or not `hbase shell -n` 
indefinitely. This might be how tty / pipes interact with the hbase shell. 
Opening this to better understand either if this is a bug or limitation in 
hbase shell, or what workarounds are there.

{color:#00875a}Works executed in CLI bash{color}
{code:java}
function check_alter_hbase () {
  HBASE_SHELL_CMD="hbase shell -n"
  hbase_state=$( echo "describe 'my_table'" | $HBASE_SHELL_CMD )
  echo $hbase_state
}
export -f check_alter_hbase
timeout 30s bash -c check_alter_hbase{code}
 

{color:#de350b}Doesn't work as bash script, stalls until timeout ** {color}
{code:java}
# cat stall.sh
function check_alter_hbase () {
  HBASE_SHELL_CMD="hbase shell -n"
  hbase_state=$( echo "describe 'my_table'" | $HBASE_SHELL_CMD )
  echo $hbase_state
}
export -f check_alter_hbase
timeout 30s bash -c check_alter_hbase
# echo $?
124{code}
 

{color:#00875a}Works executed in CLI as bash script{color}
{code:java}
# cat works.sh
function check_alter_hbase () {
  HBASE_SHELL_CMD="hbase shell -n"
  hbase_state=$( echo "describe 'my_table'" | $HBASE_SHELL_CMD )
  echo $hbase_state
}
export -f check_alter_hbase
timeout --foreground 30s bash -c check_alter_hbase
# bash works.sh
Table my_table is ENABLED ...
# echo $?
0{code}
 

{color:#FF0000}Doesn't work as internal init script, stalls (called indirectly 
not via CLI){color}
{code:java}
function check_alter_hbase () {
  HBASE_SHELL_CMD="hbase shell -n"
  hbase_state=$( echo "describe 'my_table'" | $HBASE_SHELL_CMD )
  echo $hbase_state
}
export -f check_alter_hbase
timeout --foreground 30s bash -c check_alter_hbase{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to