You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2017/02/22 08:11:45 UTC

hbase git commit: HBASE-17676 Get class name once for all in AbstractFSWAL

Repository: hbase
Updated Branches:
  refs/heads/master c579cf67b -> 93e60153b


HBASE-17676 Get class name once for all in AbstractFSWAL


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/93e60153
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/93e60153
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/93e60153

Branch: refs/heads/master
Commit: 93e60153b0cef83ff6dafc03d771c9d41a23dc3a
Parents: c579cf6
Author: Yu Li <li...@apache.org>
Authored: Wed Feb 22 15:50:09 2017 +0800
Committer: Yu Li <li...@apache.org>
Committed: Wed Feb 22 15:50:09 2017 +0800

----------------------------------------------------------------------
 .../hbase/regionserver/wal/AbstractFSWAL.java       | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/93e60153/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
index aad6a87..bf283f8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
@@ -265,6 +265,15 @@ public abstract class AbstractFSWAL<W> implements WAL {
    */
   private final ConcurrentMap<Thread, SyncFuture> syncFuturesByHandler;
 
+  /**
+   * The class name of the runtime implementation, used as prefix for logging/tracing.
+   * <p>
+   * Performance testing shows getClass().getSimpleName() might be a bottleneck so we store it here,
+   * refer to HBASE-17676 for more details
+   * </p>
+   */
+  protected final String implClassName;
+
   public long getFilenum() {
     return this.filenum.get();
   }
@@ -405,6 +414,7 @@ public abstract class AbstractFSWAL<W> implements WAL {
     int maxHandlersCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT, 200);
     // Presize our map of SyncFutures by handler objects.
     this.syncFuturesByHandler = new ConcurrentHashMap<Thread, SyncFuture>(maxHandlersCount);
+    this.implClassName = getClass().getSimpleName();
   }
 
   @Override
@@ -744,7 +754,7 @@ public abstract class AbstractFSWAL<W> implements WAL {
         newPath = replaceWriter(oldPath, newPath, nextWriter);
         tellListenersAboutPostLogRoll(oldPath, newPath);
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Create new " + getClass().getSimpleName() + " writer with pipeline: "
+          LOG.debug("Create new " + implClassName + " writer with pipeline: "
               + Arrays.toString(getPipeline()));
         }
         // Can we delete any of the old log files?
@@ -950,7 +960,7 @@ public abstract class AbstractFSWAL<W> implements WAL {
     if (this.closed) {
       throw new IOException("Cannot append; log is closed, regionName = " + hri.getRegionNameAsString());
     }
-    TraceScope scope = Trace.startSpan(getClass().getSimpleName() + ".append");
+    TraceScope scope = Trace.startSpan(implClassName + ".append");
     MutableLong txidHolder = new MutableLong();
     MultiVersionConcurrencyControl.WriteEntry we = key.getMvcc().begin(() -> {
       txidHolder.setValue(ringBuffer.next());
@@ -968,7 +978,7 @@ public abstract class AbstractFSWAL<W> implements WAL {
 
   @Override
   public String toString() {
-    return getClass().getSimpleName() + " " + walFilePrefix + ":" + walFileSuffix + "(num "
+    return implClassName + " " + walFilePrefix + ":" + walFileSuffix + "(num "
         + filenum + ")";
   }