Commit Graph

72 Commits

Author SHA1 Message Date
Sean Busbey fd0ecadbb9
HBASE-14067 bundle ruby files for hbase shell into a jar.
* removes some cruft from the hbase-shell pom that appears to be from coping the hbase-server pom long ago
* puts the ruby scripts into the hbase-shell jar following the guide from jruby for packaging
* removes hard coding the location of the implementation scripts from our runtime
* removes hard coding the load path for the implementation from the test code (leaves hard coding the test code location)
* provides a work around for a name conflict between our shell and the ruby stdlib shell.

closes #2515

Signed-off-by: Michael Stack <stack@apache.org>
2020-10-13 11:12:07 -05:00
Elliot 98e35842eb
HBASE-24806 Small Updates to Functionality of Shell IRB Workspace (#2232)
* HBASE-24806 Small Updates to Functionality of Shell IRB Workspace

- Move exception handler from Shell::Shell#eval_io to new method,
  Shell::Shell#exception_handler
- Add unit tests for Shell::Shell#exception_handler
- Change Shell::Shell#eval_io to no longer raise SystemExit when any error is
  seen and update unit test
- Update ruby test runner to catch SystemExit and fail to avoid tests that
  cause the test runner to incorrectly exit successfully
- Add Hbase::Loader module to find ruby scripts in the $LOAD_PATH and classpath
  using JRuby's loader.
- In hbase-shell, install IRB commands before exporting HBase commands. The
  HBase commands will override the IRB commands, and no warning will be
  printed.

* Remove unused variables from shell_test

Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: stack <stack@apache.org>
2020-08-18 13:14:34 -07:00
Elliot 7eff07d6bf
HBASE-11686 Shell code should create a binding / irb workspace instead of polluting the root namespace (#2141)
* HBASE-11686 Shell code should create a binding / irb workspace instead of polluting the root namespace

- Refactor Shell.export_commands to define commands using ruby lambdas.
  Additionally, this change stores a reference to shell_inst in scope so that
  we no longer need to assume the existance of the variable @shell.
- Add logic to Shell class for constructing an IRB workspace with its own
  binding and non-global receiver. This workspace is loaded with all HBase and
  IRB commands.
- Create new method on Shell for evaluating input from an arbitrary IO instance
  within the created IRB workspace. This is based on work by Hsieh that was
  previously in bin/hirb.rb. This method is more generic and more testable.
  This single pattern can be used for both executing files and reading from
  stdin, therefore reducing complexity.
- Move special 'help' and 'tools' command definitions to shell.rb. These
  commands are tightly linked with an instance of the shell, so it is easiest
  to have them defined together.
- Remove all global includes of HBaseConstants from ruby test files. Before
  this change, tests were loading these constants into the top level, which
  could cause tests to pass that should really fail.
- Try to reduce the number of places that constants are included. I think it's
  best to reference each ruby constant's full name, but where that would cause
  a big diff I instead moved the include to the innermost Module or Class.
- Update docs and comments
- Remove unneccessary includes
- Add shell --top-level-cmds compatibility flag. Since this PR removes all the
  HBase symbols from the top-level receiver (ie. main Object), it is possible
  (albeit unlikely) that this will break operator scripts. This flag will
  export all the commands at the top-level like the shell previously did.

* HBASE-11686 Light refactoring with added unit tests

- Fixes some constants references by admin test 2
- Install HBase commands as singleton methods on recevier instances so that
  multiple receivers may exist.
- Rename new flag from --top-level-cmds to --top-level-defs to be more
  semantically accurate.
- Create new helper method Shell::Shell#export_all to install @hbase, @shell,
  constants, and all hbase commands to a target receiver. As a result, the
  HBaseReceiver became very simple and could be moved to shell.rb.
- Add unit tests for Shell::Shell#eval_io and Shell::Shell#export_all
- Add @hbase and @shell to hbase-shell IRB workspace
- Fix robocop issues within patch

* Typo s/is/if/
2020-07-27 20:56:09 -07:00
Sakthi 65caa08edc HBASE-21812 Address ruby static analysis for shell/bin modules [2nd pass]
Signed-off-by: Sean Busbey <busbey@apache.org>
2019-02-03 06:39:53 -06:00
stack da9508d427 HBASE-21567 Allow overriding configs starting up the shell
Adds support for -D as option to 'hbase shell'
2018-12-08 15:08:19 -08:00
Sean Busbey de57d08226 HBASE-20276 restore original shell REPL functionality where commands can return results
* makes commands always pass any results back to hirb
* print warning if hirb is given the --return-values flag
* add some docs on how to avoid the console clutter that HBASE-15965 sought to address
* add an upgrade section note about this change.
* cleanup where the get_splits command does its printing so there's a building block that doesn't print
* some rubocop suggested tweaks and opt-out for classlength check on table and shell classes.

Signed-off-by: Mike Drob <mdrob@apache.org>
2018-04-06 13:03:15 -05:00
Josh Elser 7224546b1e HBASE-19770 Separate command return values from interactive shells
Uses a new option to the shell to specify that return values are
unwanted instead of overloading the interactive option. Enable
return_values when the shell is non-interactive.

Signed-off-by: Apekshit Sharma <appy@apache.org>
2018-01-17 13:14:46 -05:00
Apekshit Sharma 31234eb862 HBASE-16459 Remove unused hbase shell --format option 2017-11-10 00:08:02 -08:00
Mike Drob ea8fa59a4c HBASE-18238 rubocop autocorrect for bin/ 2017-08-14 13:53:37 -05:00
Mike Drob 775179bc4a HBASE-18393 Fix shell noninteractive launch
Signed-off-by: Sean Busbey <busbey@apache.org>
2017-07-19 13:54:55 -05:00
Apekshit bdb46f01b9 HBASE-15845 Changes:
- Renaming hbase.rb to hbase_constants.rb because there are two hbase.rb files right now which is confusing.
- Remove omnipresence of formatter object since it is kind of a use-and-throw class. Commands should create
  an instance, use it to format the output and discard it.
- Some refactoring

Change-Id: If9ea9873904e0a39d199a6aa10e23864b86a2f09
2016-06-03 13:37:38 -07:00
Jonathan M Hsieh 4b8a38ebb5 HBASE-11658 Piped commands to hbase shell should return non-zero if shell command failed (Sean Busbey) 2014-08-08 13:54:53 -07:00
Sean Busbey 41ecb18c20 HBASE-11662 shell should properly handle long form --debug.
Signed-off-by: Andrew Purtell <apurtell@apache.org>
2014-08-04 21:31:30 -07:00
jeffreyz ed864807e3 HBASE-9210: hbase shell -d doesn't print out exception stack trace
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1516293 13f79535-47bb-0310-9956-ffa450edef68
2013-08-21 20:21:14 +00:00
Michael Stack 094e8d4420 HBASE-3925 Make Shell's -d and debug cmd behave the same
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1402923 13f79535-47bb-0310-9956-ffa450edef68
2012-10-28 01:37:04 +00:00
Michael Stack 9ae8410f77 HBASE-3870 Purge copyrights from src headers
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1380965 13f79535-47bb-0310-9956-ffa450edef68
2012-09-05 03:37:02 +00:00
Michael Stack 390f32d79f HBASE-4336 Convert source tree into maven modules
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1342856 13f79535-47bb-0310-9956-ffa450edef68
2012-05-26 05:56:04 +00:00
larsh 8f101720a2 HBASE-3924 Improve Shell's CLI help (Harsh J)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1225370 13f79535-47bb-0310-9956-ffa450edef68
2011-12-28 22:57:30 +00:00
Todd Lipcon 12855081cc HBASE-2632. Shell should autodetect terminal width
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@949803 13f79535-47bb-0310-9956-ffa450edef68
2010-05-31 16:49:50 +00:00
Michael Stack 897e903d90 HBASE-2577 Remove 'core' maven module; move core up a level hbase-issues
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@946736 13f79535-47bb-0310-9956-ffa450edef68
2010-05-20 18:10:57 +00:00
Andrew Kyle Purtell a03976103d added copyright notices
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@928089 13f79535-47bb-0310-9956-ffa450edef68
2010-03-26 22:45:48 +00:00
Michael Stack dfc23200bd HBASE-2313 Nit-pick about hbase-2279 shell fixup, if you do get with non-existant column family, throws lots of exceptions
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@923894 13f79535-47bb-0310-9956-ffa450edef68
2010-03-16 17:43:09 +00:00
Michael Stack 4770ea178a HBASE-2279 Hbase Shell does not have any tests
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@922110 13f79535-47bb-0310-9956-ffa450edef68
2010-03-12 01:36:04 +00:00
Michael Stack 73aa65deb3 HBASE-2035 Binary values are formatted wrong in shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@896738 13f79535-47bb-0310-9956-ffa450edef68
2010-01-07 02:25:12 +00:00
Jean-Daniel Cryans 1241459503 HBASE-2081 Set the retries higher in shell since client pause is lower
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@894743 13f79535-47bb-0310-9956-ffa450edef68
2009-12-30 23:47:41 +00:00
Andrew Kyle Purtell c609d25614 HBASE-2028 Add HTable.incrementColumnValue support to shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@892648 13f79535-47bb-0310-9956-ffa450edef68
2009-12-20 19:50:23 +00:00
Jean-Daniel Cryans 04155cac92 HBASE-2044 HBASE-1822 removed not-deprecated APIs
HBASE-2041  Change WAL default configuration values
            changes to the shell and fixing interrupt bug


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@891073 13f79535-47bb-0310-9956-ffa450edef68
2009-12-15 23:41:40 +00:00
Michael Stack 5c6931f263 HBASE-2029 Reduce shell exception dump on console
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@888132 13f79535-47bb-0310-9956-ffa450edef68
2009-12-07 20:54:58 +00:00
Michael Stack 41558cf59d HBASE-1859 Misc shell fixes patch
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@817947 13f79535-47bb-0310-9956-ffa450edef68
2009-09-23 03:10:49 +00:00
Andrew Kyle Purtell a4ee96d5fd HBASE-1827 Add disabling block cache scanner flag to the shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@814093 13f79535-47bb-0310-9956-ffa450edef68
2009-09-12 00:11:39 +00:00
Michael Stack e2f5f48014 HBASE-1640 Allow passing arguments to jruby script run when run by bin/hbase shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@792802 13f79535-47bb-0310-9956-ffa450edef68
2009-07-10 04:20:48 +00:00
Michael Stack 969b989c63 HBASE-1450 Scripts passed to hbase shell do not have shell context set up for them
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@788550 13f79535-47bb-0310-9956-ffa450edef68
2009-06-25 23:53:04 +00:00
Michael Stack 7886526f30 HBASE-1578 Change the name of the in-memory updates from 'memcache' to 'memtable' or....
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@788160 13f79535-47bb-0310-9956-ffa450edef68
2009-06-24 19:56:51 +00:00
Michael Stack 624b155cf4 HBASE-1329 Visibility into ZooKeeper
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@785470 13f79535-47bb-0310-9956-ffa450edef68
2009-06-17 03:46:12 +00:00
Michael Stack d1a678ca83 HBASE-1509 Add explanation to shell help command on how to use binary keys
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@783993 13f79535-47bb-0310-9956-ffa450edef68
2009-06-12 06:04:58 +00:00
Michael Stack d3f7947323 HBASE-1478 Remove hbase master options from shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@781263 13f79535-47bb-0310-9956-ffa450edef68
2009-06-03 05:11:48 +00:00
Andrew Kyle Purtell f43fba2216 HBASE-1494 HBaseAdmin.getClusterStatus; minor formatting change for shell support
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@779689 13f79535-47bb-0310-9956-ffa450edef68
2009-05-28 17:34:51 +00:00
Andrew Kyle Purtell 5e1b305116 HBASE-1454 HBaseAdmin.getClusterStatus
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@779443 13f79535-47bb-0310-9956-ffa450edef68
2009-05-28 05:48:52 +00:00
Michael Stack 59c6ce905d HBASE-1383 hbase shell needs to warn on deleting multi-region table
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@772499 13f79535-47bb-0310-9956-ffa450edef68
2009-05-07 04:48:44 +00:00
Andrew Kyle Purtell 80eae9d2af HBASE-1178 Add shutdown command to shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@740265 13f79535-47bb-0310-9956-ffa450edef68
2009-02-03 10:22:06 +00:00
Jean-Daniel Cryans 86e3267abb HBASE-845 HCM.isTableEnabled doesn't really tell if it is, or not
HBASE-903   [shell] Can't set table descriptor attributes when I alter a table



git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@738927 13f79535-47bb-0310-9956-ffa450edef68
2009-01-29 16:51:26 +00:00
Michael Stack 14734e4e81 HBASE-5121 Fix shell usage for format.width
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@737312 13f79535-47bb-0310-9956-ffa450edef68
2009-01-24 07:11:32 +00:00
Michael Stack 4dde10431e HBASE-1082 Administrative functions for table/region maintenance
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@731801 13f79535-47bb-0310-9956-ffa450edef68
2009-01-06 01:12:36 +00:00
Michael Stack d47bdad4fd HBASE-1066 Master should support close/open/reassignment/enable/disable operations on individual regions
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@729168 13f79535-47bb-0310-9956-ffa450edef68
2008-12-23 23:10:25 +00:00
Michael Stack e1d9bf64c2 HBASE-782 The DELETE key in the hbase shell deletes the wrong character
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@728733 13f79535-47bb-0310-9956-ffa450edef68
2008-12-22 17:50:02 +00:00
Michael Stack 3b803714c5 HBASE-817 Hbase/Shell Truncate
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@708966 13f79535-47bb-0310-9956-ffa450edef68
2008-10-29 18:01:35 +00:00
Michael Stack 8932609a36 HBASE-844 Can't pass script to hbase shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@703027 13f79535-47bb-0310-9956-ffa450edef68
2008-10-09 00:03:50 +00:00
Michael Stack 252e017903 HBASE-852 Cannot scan all families in a row with a LIMIT, STARTROW, etc.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@703025 13f79535-47bb-0310-9956-ffa450edef68
2008-10-08 23:45:30 +00:00
Michael Stack b174254d9e HBASE-890 alter table operation and also related changes in REST interface
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@698001 13f79535-47bb-0310-9956-ffa450edef68
2008-09-22 21:16:21 +00:00
Michael Stack fe19bdd5b2 HBASE-872 Getting exceptions in shell when creating/disabling tables
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@692585 13f79535-47bb-0310-9956-ffa450edef68
2008-09-05 23:57:40 +00:00