Author: stack
Date: Mon Dec 7 20:54:58 2009
New Revision: 888132
URL: http://svn.apache.org/viewvc?rev=888132&view=rev
Log:
HBASE-2029 Reduce shell exception dump on console
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/bin/hirb.rb
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=888132&r1=888131&r2=888132&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Dec 7 20:54:58 2009
@@ -216,6 +216,8 @@
Purtell)
HBASE-2017 Set configurable max value size check to 10MB
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
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write
Modified: hadoop/hbase/trunk/bin/hirb.rb
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hirb.rb?rev=888132&r1=888131&r2=888132&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hirb.rb (original)
+++ hadoop/hbase/trunk/bin/hirb.rb Mon Dec 7 20:54:58 2009
@@ -18,17 +18,11 @@
# Some goodies for hirb. Should these be left up to the user's discretion?
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
# load path so I can load up my HBase ruby modules
$LOAD_PATH.unshift File.dirname($PROGRAM_NAME)
-# Require formatter and hbase
+# Require formatter
require 'Formatter'
-require 'HBase'
# 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'
@@ -36,11 +30,13 @@
HBase Shell command-line options:
format Formatter for outputting results: console | html. Default:
console
format-width Width of table outputs. Default: 110 characters.
+ -d | --debug Set DEBUG log levels.
HERE
found = []
format = 'console'
format_width = 110
script2run = nil
+logLevel = org.apache.log4j.Level::ERROR
for arg in ARGV
if arg =~ /^--format=(.+)/i
format = $1
@@ -58,6 +54,10 @@
elsif arg == '-h' || arg == '--help'
puts cmdline_help
exit
+ elsif arg == '-d' || arg == '--debug'
+ logLevel = org.apache.log4j.Level::DEBUG
+ $fullBackTrace = true
+ puts "Setting DEBUG log level..."
else
# Presume it a script. Save it off for running later below
# after we've set up some environment.
@@ -70,11 +70,20 @@
for arg in found
ARGV.delete(arg)
end
+
# Presume console format.
# Formatter takes an :output_stream parameter, if you don't want STDOUT.
@formatter = Formatter::Console.new(:format_width => format_width)
# 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.
# Turn off retries in hbase and ipc. Human doesn't want to wait on N retries.
@configuration = org.apache.hadoop.hbase.HBaseConfiguration.new()
@@ -478,6 +487,7 @@
IRB.setup(ap_path)
@CONF[:IRB_NAME] = 'hbase'
@CONF[:AP_NAME] = 'hbase'
+ @CONF[:BACK_TRACE_LIMIT] = 0 unless $fullBackTrace
if @CONF[:SCRIPT]
hirb = HIRB.new(nil, @CONF[:SCRIPT])
Modified:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=888132&r1=888131&r2=888132&view=diff
==============================================================================
---
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
(original)
+++
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Mon Dec 7 20:54:58 2009
@@ -196,8 +196,10 @@
*/
public void process(WatchedEvent event) {
KeeperState state = event.getState();
- LOG.debug("Got ZooKeeper event, state: " + state + ", type: "
- + event.getType() + ", path: " + event.getPath());
+ if(!state.equals(KeeperState.SyncConnected)) {
+ LOG.debug("Got ZooKeeper event, state: " + state + ", type: "
+ + event.getType() + ", path: " + event.getPath());
+ }
if (state == KeeperState.Expired) {
resetZooKeeper();
}
@@ -698,7 +700,7 @@
if (LOG.isDebugEnabled()) {
LOG.debug("locateRegionInMeta attempt " + tries + " of " +
this.numRetries + " failed; retrying after sleep of " +
- getPauseTime(tries), e);
+ getPauseTime(tries) + " because: " + e.getMessage());
}
relocateRegion(parentTable, metaKey);
} else {
@@ -862,7 +864,9 @@
SoftValueSortedMap<byte [], HRegionLocation> tableLocations =
getTableLocations(tableName);
if (tableLocations.put(startKey, location) == null) {
- LOG.debug("Cached location " + location);
+ LOG.debug("Cached location for " +
+ location.getRegionInfo().getRegionNameAsString() +
+ " is " + location.getServerAddress());
}
}