hbase/bin
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
..
replication HBASE-10092 Addendum. Move to slf4j. Few changes in bin/ scripts. 2017-12-21 19:22:00 -08:00
test HBASE-8431 Fix missing license headers 2013-04-25 03:20:51 +00:00
considerAsDead.sh HBASE-14087 Ensure correct ASF headers for docs/code 2015-07-29 14:25:43 -05:00
draining_servers.rb HBASE-22783 shell with removal of status and load classes 2019-08-06 19:20:22 +02:00
get-active-master.rb HBASE-19114 addendum. Split out o.a.h.h.zookeeper from hbase-server and hbase-client. Ruby scripts also used ZooKeeperWatcher. 2018-03-03 21:06:53 +05:30
graceful_stop.sh HBASE-24671 Add excludefile and designatedfile options to graceful_stop.sh 2020-07-05 19:34:23 +05:30
hbase HBASE-24550 Passing '-h' or '--help' to bin/hbase doesn't do as expected 2020-06-18 15:42:57 +05:30
hbase-cleanup.sh HBASE-19140 hbase-cleanup.sh uses deprecated call to remove files in hdfs 2017-11-01 10:30:49 -07:00
hbase-common.sh HBASE-7908 Add jstack logs in hbase-common.sh when killing the server 2013-03-26 15:07:08 +00:00
hbase-config.cmd HBASE-24550 Passing '-h' or '--help' to bin/hbase doesn't do as expected (ADDENDUM) 2020-06-19 22:52:18 +05:30
hbase-config.sh HBASE-24550 Passing '-h' or '--help' to bin/hbase doesn't do as expected 2020-06-18 15:42:57 +05:30
hbase-daemon.sh HBASE-18274 hbase autorestart will overwrite the gc log (Fangyuan Deng) 2017-06-27 08:03:26 -07:00
hbase-daemons.sh HBASE-15924 Enhance hbase services autorestart capability to hbase-daemon.sh 2016-12-20 17:37:10 -08:00
hbase-jruby HBASE-5364 Fix source files missing license in 0.92 and trunk (Elliott Clark) 2012-02-10 20:07:36 +00:00
hbase.cmd HBASE-24550 Passing '-h' or '--help' to bin/hbase doesn't do as expected (ADDENDUM) 2020-06-19 22:52:18 +05:30
hirb.rb HBASE-11686 Shell code should create a binding / irb workspace instead of polluting the root namespace (#2141) 2020-07-27 20:56:09 -07:00
local-master-backup.sh HBASE-15924 Enhance hbase services autorestart capability to hbase-daemon.sh 2016-12-20 17:37:10 -08:00
local-regionservers.sh HBASE-20130 (ADDENDUM) Use defaults (16020 & 16030) as base ports when the RS is bound to localhost 2018-03-27 21:24:12 -05:00
master-backup.sh HBASE-14087 Ensure correct ASF headers for docs/code 2015-07-29 14:25:43 -05:00
region_mover.rb HBASE-18238 rubocop autocorrect for bin/ 2017-08-14 13:53:37 -05:00
region_status.rb HBASE-22783 shell with removal of status and load classes 2019-08-06 19:20:22 +02:00
regionservers.sh HBASE-20130 Use defaults (16020 & 16030) as base ports when the RS is bound to localhost 2018-03-26 14:11:20 -07:00
rolling-restart.sh HBASE-18392 Add default value of --movetimeout to rolling-restart.sh 2017-07-18 07:04:29 -07:00
shutdown_regionserver.rb HBASE-21812 Address ruby static analysis for shell/bin modules [2nd pass] 2019-02-03 06:39:53 -06:00
start-hbase.cmd HBASE-6815. [WINDOWS] Provide hbase scripts in order to start HBASE on Windows in a single user mode. (Slavik Krassovsky) 2013-01-25 23:33:22 +00:00
start-hbase.sh HBASE-15924 Enhance hbase services autorestart capability to hbase-daemon.sh 2016-12-20 17:37:10 -08:00
stop-hbase.cmd HBASE-6815. [WINDOWS] Provide hbase scripts in order to start HBASE on Windows in a single user mode. (Slavik Krassovsky) 2013-01-25 23:33:22 +00:00
stop-hbase.sh HBASE-19784 bin/stop-hbase more friendly when hbase already stopped 2018-01-17 15:48:53 -08:00
zookeepers.sh HBASE-14087 Ensure correct ASF headers for docs/code 2015-07-29 14:25:43 -05:00