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
This commit is contained in:
Michael Stack 2009-06-25 23:53:04 +00:00
parent 1eb46d4be7
commit 969b989c63
2 changed files with 16 additions and 3 deletions

View File

@ -225,6 +225,8 @@ Release 0.20.0 - Unreleased
(Lars George via Stack) (Lars George via Stack)
HBASE-1563 incrementColumnValue does not write to WAL (Jon Gray via Stack) HBASE-1563 incrementColumnValue does not write to WAL (Jon Gray via Stack)
HBASE-1569 rare race condition can take down a regionserver HBASE-1569 rare race condition can take down a regionserver
HBASE-1450 Scripts passed to hbase shell do not have shell context set up
for them
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -18,6 +18,11 @@ include Java
# Some goodies for hirb. Should these be left up to the user's discretion? # Some goodies for hirb. Should these be left up to the user's discretion?
require 'irb/completion' require 'irb/completion'
# Hack to turn down zk logging so it don't spew over the shell
# log4j.logger.org.apache.zookeeper=INFO
logger = org.apache.log4j.Logger.getLogger("org.apache.zookeeper")
logger.setLevel(org.apache.log4j.Level::WARN);
# Add the $HBASE_HOME/bin directory, the location of this script, to the ruby # Add the $HBASE_HOME/bin directory, the location of this script, to the ruby
# load path so I can load up my HBase ruby modules # load path so I can load up my HBase ruby modules
$LOAD_PATH.unshift File.dirname($PROGRAM_NAME) $LOAD_PATH.unshift File.dirname($PROGRAM_NAME)
@ -35,6 +40,7 @@ HERE
found = [] found = []
format = 'console' format = 'console'
format_width = 110 format_width = 110
script2run = nil
for arg in ARGV for arg in ARGV
if arg =~ /^--format=(.+)/i if arg =~ /^--format=(.+)/i
format = $1 format = $1
@ -53,9 +59,10 @@ for arg in ARGV
puts cmdline_help puts cmdline_help
exit exit
else else
# Presume it a script and try running it. Will go on to run the shell unless # Presume it a script. Save it off for running later below
# script calls 'exit' or 'exit 0' or 'exit errcode'. # after we've set up some environment.
load(arg) script2run = arg
found.push(arg)
end end
end end
for arg in found for arg in found
@ -91,6 +98,10 @@ promoteConstants(org.apache.hadoop.hbase.HColumnDescriptor.constants)
promoteConstants(org.apache.hadoop.hbase.HTableDescriptor.constants) promoteConstants(org.apache.hadoop.hbase.HTableDescriptor.constants)
promoteConstants(HBase.constants) promoteConstants(HBase.constants)
# If script2run, try running it. Will go on to run the shell unless
# script calls 'exit' or 'exit 0' or 'exit errcode'.
load(script2run) if script2run
# Start of the hbase shell commands. # Start of the hbase shell commands.
# General shell methods # General shell methods