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
This commit is contained in:
Michael Stack 2009-12-07 20:54:58 +00:00
parent b571ae532d
commit 5c6931f263
3 changed files with 27 additions and 11 deletions

View File

@ -216,6 +216,8 @@ Release 0.21.0 - Unreleased
Purtell) Purtell)
HBASE-2017 Set configurable max value size check to 10MB HBASE-2017 Set configurable max value size check to 10MB
HBASE-2019 [EC2] remember credentials if not configured HBASE-2019 [EC2] remember credentials if not configured
HBASE-2029 Reduce shell exception dump on console
(Lars George and J-D via Stack)
NEW FEATURES NEW FEATURES
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write

View File

@ -18,17 +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)
# Require formatter and hbase # Require formatter
require 'Formatter' require 'Formatter'
require 'HBase'
# See if there are args for this shell. If any, read and then strip from ARGV # See if there are args for this shell. If any, read and then strip from ARGV
# so they don't go through to irb. Output shell 'usage' if user types '--help' # so they don't go through to irb. Output shell 'usage' if user types '--help'
@ -36,11 +30,13 @@ cmdline_help = <<HERE # HERE document output as shell usage
HBase Shell command-line options: HBase Shell command-line options:
format Formatter for outputting results: console | html. Default: console format Formatter for outputting results: console | html. Default: console
format-width Width of table outputs. Default: 110 characters. format-width Width of table outputs. Default: 110 characters.
-d | --debug Set DEBUG log levels.
HERE HERE
found = [] found = []
format = 'console' format = 'console'
format_width = 110 format_width = 110
script2run = nil script2run = nil
logLevel = org.apache.log4j.Level::ERROR
for arg in ARGV for arg in ARGV
if arg =~ /^--format=(.+)/i if arg =~ /^--format=(.+)/i
format = $1 format = $1
@ -58,6 +54,10 @@ for arg in ARGV
elsif arg == '-h' || arg == '--help' elsif arg == '-h' || arg == '--help'
puts cmdline_help puts cmdline_help
exit exit
elsif arg == '-d' || arg == '--debug'
logLevel = org.apache.log4j.Level::DEBUG
$fullBackTrace = true
puts "Setting DEBUG log level..."
else else
# Presume it a script. Save it off for running later below # Presume it a script. Save it off for running later below
# after we've set up some environment. # after we've set up some environment.
@ -70,11 +70,20 @@ end
for arg in found for arg in found
ARGV.delete(arg) ARGV.delete(arg)
end end
# Presume console format. # Presume console format.
# Formatter takes an :output_stream parameter, if you don't want STDOUT. # Formatter takes an :output_stream parameter, if you don't want STDOUT.
@formatter = Formatter::Console.new(:format_width => format_width) @formatter = Formatter::Console.new(:format_width => format_width)
# TODO, etc. @formatter = Formatter::XHTML.new(STDOUT) # TODO, etc. @formatter = Formatter::XHTML.new(STDOUT)
# Set logging level to avoid verboseness
logger = org.apache.log4j.Logger.getLogger("org.apache.zookeeper")
logger.setLevel(logLevel);
logger = org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase")
logger.setLevel(logLevel);
# Require HBase now after setting log levels
require 'HBase'
# Setup the HBase module. Create a configuration. # Setup the HBase module. Create a configuration.
# Turn off retries in hbase and ipc. Human doesn't want to wait on N retries. # Turn off retries in hbase and ipc. Human doesn't want to wait on N retries.
@configuration = org.apache.hadoop.hbase.HBaseConfiguration.new() @configuration = org.apache.hadoop.hbase.HBaseConfiguration.new()
@ -478,6 +487,7 @@ module IRB
IRB.setup(ap_path) IRB.setup(ap_path)
@CONF[:IRB_NAME] = 'hbase' @CONF[:IRB_NAME] = 'hbase'
@CONF[:AP_NAME] = 'hbase' @CONF[:AP_NAME] = 'hbase'
@CONF[:BACK_TRACE_LIMIT] = 0 unless $fullBackTrace
if @CONF[:SCRIPT] if @CONF[:SCRIPT]
hirb = HIRB.new(nil, @CONF[:SCRIPT]) hirb = HIRB.new(nil, @CONF[:SCRIPT])

View File

@ -196,8 +196,10 @@ public class HConnectionManager implements HConstants {
*/ */
public void process(WatchedEvent event) { public void process(WatchedEvent event) {
KeeperState state = event.getState(); KeeperState state = event.getState();
if(!state.equals(KeeperState.SyncConnected)) {
LOG.debug("Got ZooKeeper event, state: " + state + ", type: " LOG.debug("Got ZooKeeper event, state: " + state + ", type: "
+ event.getType() + ", path: " + event.getPath()); + event.getType() + ", path: " + event.getPath());
}
if (state == KeeperState.Expired) { if (state == KeeperState.Expired) {
resetZooKeeper(); resetZooKeeper();
} }
@ -698,7 +700,7 @@ public class HConnectionManager implements HConstants {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("locateRegionInMeta attempt " + tries + " of " + LOG.debug("locateRegionInMeta attempt " + tries + " of " +
this.numRetries + " failed; retrying after sleep of " + this.numRetries + " failed; retrying after sleep of " +
getPauseTime(tries), e); getPauseTime(tries) + " because: " + e.getMessage());
} }
relocateRegion(parentTable, metaKey); relocateRegion(parentTable, metaKey);
} else { } else {
@ -862,7 +864,9 @@ public class HConnectionManager implements HConstants {
SoftValueSortedMap<byte [], HRegionLocation> tableLocations = SoftValueSortedMap<byte [], HRegionLocation> tableLocations =
getTableLocations(tableName); getTableLocations(tableName);
if (tableLocations.put(startKey, location) == null) { if (tableLocations.put(startKey, location) == null) {
LOG.debug("Cached location " + location); LOG.debug("Cached location for " +
location.getRegionInfo().getRegionNameAsString() +
" is " + location.getServerAddress());
} }
} }