hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenh...@apache.org
Subject hbase git commit: HBASE-15720 Print row locks at the debug dump page
Date Thu, 28 Apr 2016 04:40:36 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 1c70befd7 -> 716ca48a7


HBASE-15720 Print row locks at the debug dump page

Conflicts:
    hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
	hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java


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

Branch: refs/heads/0.98
Commit: 716ca48a7491ecf561efba532fb7a5ff3f7a5e57
Parents: 1c70bef
Author: chenheng <chenheng@apache.org>
Authored: Thu Apr 28 12:18:32 2016 +0800
Committer: chenheng <chenheng@apache.org>
Committed: Thu Apr 28 12:37:55 2016 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 15 +++++++++++++-
 .../hbase/regionserver/RSDumpServlet.java       | 21 +++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/716ca48a/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 aa88257..f426cdd 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
@@ -250,7 +250,6 @@ public class HRegion implements HeapSize { // , Writable{
   //////////////////////////////////////////////////////////////////////////////
   // Members
   //////////////////////////////////////////////////////////////////////////////
-
   // map from a locked row to the context for that lock including:
   // - CountDownLatch for threads waiting on that row
   // - the thread that owns the lock (allow reentrancy)
@@ -6616,6 +6615,15 @@ public class HRegion implements HeapSize { // , Writable{
         latch.countDown();
       }
     }
+
+    @Override
+    public String toString() {
+     return "RowLockContext{" +
+         "row=" + row +
+         ", count=" + lockCount +
+         ", threadName=" + thread.getName() +
+         '}';
+    }
   }
 
   /**
@@ -6660,4 +6668,9 @@ public class HRegion implements HeapSize { // , Writable{
   public void updatesUnlock() throws InterruptedIOException {
     updatesLock.readLock().unlock();
   }
+
+  public ConcurrentHashMap<HashedBytes, RowLockContext> getLockedRows() {
+    return lockedRows;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/716ca48a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
index f2aab40..fd72245 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
@@ -72,7 +72,11 @@ public class RSDumpServlet extends StateDumpServlet {
     out.println("\n\nTasks:");
     out.println(LINE);
     TaskMonitor.get().dumpAsText(out);
-    
+
+    out.println("\n\nRowLocks:");
+    out.println(LINE);
+    dumpRowLock(hrs, out);
+
     out.println("\n\nExecutors:");
     out.println(LINE);
     dumpExecutors(hrs.getExecutorService(), out);
@@ -120,5 +124,20 @@ public class RSDumpServlet extends StateDumpServlet {
         + hrs.cacheFlusher.toString());
     out.println(hrs.cacheFlusher.dumpQueue());
   }
+
+  public static void dumpRowLock(HRegionServer hrs, PrintWriter out) {
+    StringBuilder sb = new StringBuilder();
+    for (HRegion hRegion : hrs.getOnlineRegionsLocalContext()) {
+      if (hRegion.getLockedRows().size() > 0) {
+        for (HRegion.RowLockContext rowLockContext : hRegion.getLockedRows().values()) {
+          sb.setLength(0);
+          sb.append(hRegion.getTableDesc().getTableName()).append(",")
+            .append(hRegion.getRegionInfo().getEncodedName()).append(",");
+          sb.append(rowLockContext.toString());
+          out.println(sb.toString());
+        }
+      }
+    }
+  }
   
 }


Mime
View raw message