hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject hbase git commit: HBASE-13054 Provide more tracing information for locking/latching events.(Rajeshbabu)
Date Sat, 21 Feb 2015 06:43:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 47d081407 -> 7792dee0c


HBASE-13054 Provide more tracing information for locking/latching events.(Rajeshbabu)


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

Branch: refs/heads/master
Commit: 7792dee0c36de9b3108ebf60f6394f2d7e9a1b9f
Parents: 47d0814
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Sat Feb 21 12:13:10 2015 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Sat Feb 21 12:13:10 2015 +0530

----------------------------------------------------------------------
 .../apache/hadoop/hbase/io/hfile/HFileReaderV2.java    |  3 +++
 .../hadoop/hbase/regionserver/DefaultMemStore.java     |  4 ++++
 .../org/apache/hadoop/hbase/regionserver/HRegion.java  | 13 +++++++++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7792dee0/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
index 250001e..5460cbd 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
@@ -402,6 +402,9 @@ public class HFileReaderV2 extends AbstractHFileReader {
           HFileBlock cachedBlock = getCachedBlock(cacheKey, cacheBlock, useLock, isCompaction,
             updateCacheMetrics, expectedBlockType, expectedDataBlockEncoding);
           if (cachedBlock != null) {
+            if (Trace.isTracing()) {
+              traceScope.getSpan().addTimelineAnnotation("blockCacheHit");
+            }
             assert cachedBlock.isUnpacked() : "Packed block leak.";
             if (cachedBlock.getBlockType().isData()) {
               if (updateCacheMetrics) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/7792dee0/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java
index 081d7a5..d8ed1b3 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultMemStore.java
@@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.util.CollectionBackedScanner;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.ReflectionUtils;
+import org.apache.htrace.Trace;
 
 /**
  * The MemStore holds in-memory modifications to the Store.  Modifications
@@ -737,6 +738,9 @@ public class DefaultMemStore implements MemStore {
         this.snapshotAllocatorAtCreation = snapshotAllocator;
         this.snapshotAllocatorAtCreation.incScannerCount();
       }
+      if (Trace.isTracing() && Trace.currentSpan() != null) {
+        Trace.currentSpan().addTimelineAnnotation("Creating MemStoreScanner");
+      }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/7792dee0/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
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 79cb7db..fb87417 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
@@ -168,6 +168,8 @@ import org.apache.hadoop.hbase.wal.WALSplitter;
 import org.apache.hadoop.hbase.wal.WALSplitter.MutationReplay;
 import org.apache.hadoop.io.MultipleIOException;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.htrace.Trace;
+import org.apache.htrace.TraceScope;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
@@ -4694,16 +4696,27 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver
{ //
         if (!waitForLock) {
           return null;
         }
+        TraceScope traceScope = null;
         try {
+          if (Trace.isTracing()) {
+            traceScope = Trace.startSpan("HRegion.getRowLockInternal");
+          }
           // Row is already locked by some other thread, give up or wait for it
           if (!existingContext.latch.await(this.rowLockWaitDuration, TimeUnit.MILLISECONDS))
{
+            if(traceScope != null) {
+              traceScope.getSpan().addTimelineAnnotation("Failed to get row lock");
+            }
             throw new IOException("Timed out waiting for lock for row: " + rowKey);
           }
+          if (traceScope != null) traceScope.close();
+          traceScope = null;
         } catch (InterruptedException ie) {
           LOG.warn("Thread interrupted waiting for lock on row: " + rowKey);
           InterruptedIOException iie = new InterruptedIOException();
           iie.initCause(ie);
           throw iie;
+        } finally {
+          if (traceScope != null) traceScope.close();
         }
       }
     }


Mime
View raw message