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 07:35:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 12ff78a48 -> a00e0d6ba


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/a00e0d6b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a00e0d6b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a00e0d6b

Branch: refs/heads/branch-1.0
Commit: a00e0d6ba4ea3ecf8548882c5b088da4029c7d3c
Parents: 12ff78a
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Sat Feb 21 13:04:57 2015 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Sat Feb 21 13:04:57 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/a00e0d6b/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 e466041..cc61f59 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
@@ -400,6 +400,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/a00e0d6b/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 48b78c2..adfe531 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
@@ -731,6 +732,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/a00e0d6b/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 86f50e1..a8e550c 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
@@ -160,6 +160,8 @@ import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
 import org.apache.hadoop.hbase.util.Threads;
 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;
@@ -3897,16 +3899,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