You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Peter Somogyi (Jira)" <ji...@apache.org> on 2022/02/07 17:03:00 UTC

[jira] [Created] (HBASE-26741) Incorrect exception handling in shell

Peter Somogyi created HBASE-26741:
-------------------------------------

             Summary: Incorrect exception handling in shell
                 Key: HBASE-26741
                 URL: https://issues.apache.org/jira/browse/HBASE-26741
             Project: HBase
          Issue Type: Bug
          Components: shell
    Affects Versions: 3.0.0-alpha-2, 2.5.0, 2.4.10
            Reporter: Peter Somogyi


The exception handling changed in the shell compared to 2.2.
{noformat}
➜  hbase-upstream git:(branch-2.4) ✗ cat commands.txt
scan 'foo'
exit
➜  hbase-upstream git:(branch-2.4) ✗ bin/hbase shell -n commands.txt
2022-02-07 16:21:33,654 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
hbase:001:0> scan 'foo'
ROW                                  COLUMN+CELL
Took 0.3890 seconds                                                                                                                         Traceback (most recent call last):
RuntimeError (Unknown table foo!)
hbase:002:0> exit
➜  hbase-upstream git:(branch-2.4) ✗ echo $?
0 {noformat}
The execution continues even after an exception is thrown. In 2.2.7 the execution stops when an exception is thrown and the shell exits with error code.
{noformat}
➜  hbase-2.2.7 bin/hbase shell -n commands.txt
2022-02-07 16:33:54,930 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
ROW                                  COLUMN+CELL
Took 0.3082 seconds                                                                                                                         RuntimeError: Unknown table foo!
  translate_hbase_exceptions at /Users/petersomogyi/tmp/hbase-2.2.7/lib/ruby/shell/commands.rb:130
                command_safe at /Users/petersomogyi/tmp/hbase-2.2.7/lib/ruby/shell/commands.rb:49
            internal_command at /Users/petersomogyi/tmp/hbase-2.2.7/lib/ruby/shell.rb:148
                     command at /Users/petersomogyi/tmp/hbase-2.2.7/lib/ruby/shell.rb:140
                        scan at (eval):2
                      <main> at commands.txt:1
                        load at org/jruby/RubyKernel.java:973
                      <main> at /Users/petersomogyi/tmp/hbase-2.2.7/bin/../bin/hirb.rb:186
➜  hbase-2.2.7 echo $?
1 {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)