From 4030facc990b95fd6f17499f1597f0892fdcb449 Mon Sep 17 00:00:00 2001 From: Nemo Chen Date: Wed, 5 Apr 2017 21:20:40 -0400 Subject: [PATCH] HBASE-16469 Several log refactoring/improvement suggestions Signed-off-by: Sean Busbey --- .../hadoop/hbase/client/PreemptiveFastFailInterceptor.java | 2 +- .../java/org/apache/hadoop/hbase/HBaseClusterManager.java | 1 + .../java/org/apache/hadoop/hbase/regionserver/HRegion.java | 6 +++--- .../hbase/regionserver/handler/CloseRegionHandler.java | 2 +- .../org/apache/hadoop/hbase/util/MultiThreadedUpdater.java | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java index 7ac5c4548fc..336a8aba265 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java @@ -301,7 +301,7 @@ class PreemptiveFastFailInterceptor extends RetryingCallerInterceptor { // If we were able to connect to the server, reset the failure // information. if (couldNotCommunicate == false) { - LOG.info("Clearing out PFFE for server " + server.getServerName()); + LOG.info("Clearing out PFFE for server " + server); repeatedFailuresMap.remove(server); } else { // update time of last attempt diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java index b0281fb13ed..a3cd73bdf77 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java @@ -84,6 +84,7 @@ public class HBaseClusterManager extends Configured implements ClusterManager { sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " "); } sshOptions = (sshOptions == null) ? "" : sshOptions; + sshUserName = (sshUserName == null) ? "" : sshUserName; tunnelCmd = conf.get("hbase.it.clustermanager.ssh.cmd", DEFAULT_TUNNEL_CMD); // Print out ssh special config if any. if ((sshUserName != null && sshUserName.length() > 0) || diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index e7e65a6a046..c75dda1cc2e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -1366,12 +1366,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi */ public boolean isMergeable() { if (!isAvailable()) { - LOG.debug("Region " + getRegionInfo().getRegionNameAsString() + LOG.debug("Region " + this + " is not mergeable because it is closing or closed"); return false; } if (hasReferences()) { - LOG.debug("Region " + getRegionInfo().getRegionNameAsString() + LOG.debug("Region " + this + " is not mergeable because it has references"); return false; } @@ -1518,7 +1518,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi // the close flag? if (!abort && worthPreFlushing() && canFlush) { status.setStatus("Pre-flushing region before close"); - LOG.info("Running close preflush of " + getRegionInfo().getRegionNameAsString()); + LOG.info("Running close preflush of " + this); try { internalFlushcache(status); } catch (IOException ioe) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java index ccb0e72fbb8..6874847a368 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java @@ -140,7 +140,7 @@ public class CloseRegionHandler extends EventHandler { // of doing the setClosedState() below, let's just ignore cont // The split message will clean up the master state. LOG.warn("Can't close region: was already closed during close(): " + - regionInfo.getRegionNameAsString()); + name); return; } } catch (IOException ioe) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java index c61bd78c562..10e9f49e8bf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java @@ -181,7 +181,7 @@ public class MultiThreadedUpdater extends MultiThreadedWriterBase { LOG.info("Null result expected for the rowkey " + Bytes.toString(rowKey)); } else { failedKeySet.add(rowKeyBase); - LOG.error("Failed to update the row with key = [" + rowKey + LOG.error("Failed to update the row with key = [" + Bytes.toString(rowKey) + "], since we could not get the original row"); } }