hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [37/50] hbase git commit: HBASE-15720 Print row locks at the debug dump page
Date Tue, 01 Nov 2016 19:51:31 GMT
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


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

Branch: refs/heads/branch-1.0
Commit: a837182b79df1eb1bf7c50418d54d9881ea26509
Parents: 719993e
Author: chenheng <chenheng@apache.org>
Authored: Thu Apr 28 12:18:32 2016 +0800
Committer: chenheng <chenheng@apache.org>
Committed: Thu Apr 28 12:25:06 2016 +0800

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/a837182b/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 8aed3a6..18a6684 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
@@ -268,7 +268,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver
{ //
   //////////////////////////////////////////////////////////////////////////////
   // 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)
@@ -3862,6 +3861,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver
{ //
     return this.stores.get(column);
   }
 
+  public ConcurrentHashMap<HashedBytes, RowLockContext> getLockedRows() {
+    return lockedRows;
+  }
+
   /**
    * Return HStore instance. Does not do any copy: as the number of store is limited, we
    *  iterate on the list.
@@ -6774,6 +6777,16 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver
{ //
         latch.countDown();
       }
     }
+
+    @Override
+    public String toString() {
+      return "RowLockContext{" +
+        "row=" + row +
+        ", count=" + lockCount +
+        ", threadName=" + thread.getName() +
+        '}';
+    }
+
   }
 
   /**
@@ -6867,4 +6880,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver
{ //
   public RegionSplitPolicy getSplitPolicy() {
     return this.splitPolicy;
   }
+
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a837182b/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 77b68ec..56d0417 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
@@ -23,7 +23,6 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.util.Date;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -69,6 +68,10 @@ public class RSDumpServlet extends StateDumpServlet {
     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);
@@ -100,6 +103,22 @@ public class RSDumpServlet extends StateDumpServlet {
     out.flush();
   }
 
+  public static void dumpRowLock(HRegionServer hrs, PrintWriter out) {
+    StringBuilder sb = new StringBuilder();
+    for (Region region : hrs.getOnlineRegionsLocalContext()) {
+      HRegion hRegion = (HRegion)region;
+      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());
+        }
+      }
+    }
+  }
+
   public static void dumpQueue(HRegionServer hrs, PrintWriter out)
       throws IOException {
     if (hrs.compactSplitThread != null) {


Mime
View raw message