hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1360179 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver: CompactSplitThread.java HRegionServer.java MemStoreFlusher.java RSDumpServlet.java
Date Wed, 11 Jul 2012 14:06:20 GMT
Author: stack
Date: Wed Jul 11 14:06:20 2012
New Revision: 1360179

URL: http://svn.apache.org/viewvc?rev=1360179&view=rev
Log:
HBASE-2730 Expose RS work queue contents on web UI

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=1360179&r1=1360178&r2=1360179&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
Wed Jul 11 14:06:20 2012
@@ -20,6 +20,8 @@
 package org.apache.hadoop.hbase.regionserver;
 
 import java.io.IOException;
+import java.util.Iterator;
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Executors;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
@@ -119,6 +121,40 @@ public class CompactSplitThread implemen
         + smallCompactions.getQueue().size() + ")"
         + ", split_queue=" + splits.getQueue().size();
   }
+  
+  public String dumpQueue() {
+    StringBuffer queueLists = new StringBuffer();
+    queueLists.append("Compaction/Split Queue dump:\n");
+    queueLists.append("  LargeCompation Queue:\n");
+    BlockingQueue<Runnable> lq = largeCompactions.getQueue();
+    Iterator it = lq.iterator();
+    while(it.hasNext()){
+      queueLists.append("    "+it.next().toString());
+      queueLists.append("\n");
+    }
+    
+    if( smallCompactions != null ){
+      queueLists.append("\n");
+      queueLists.append("  SmallCompation Queue:\n");
+      lq = smallCompactions.getQueue();
+      it = lq.iterator();
+      while(it.hasNext()){
+        queueLists.append("    "+it.next().toString());
+        queueLists.append("\n");
+      }
+    }
+    
+    queueLists.append("\n");
+    queueLists.append("  Split Queue:\n");
+    lq = splits.getQueue();
+    it = lq.iterator();
+    while(it.hasNext()){
+      queueLists.append("    "+it.next().toString());
+      queueLists.append("\n");
+    }
+    
+    return queueLists.toString();
+  }
 
   public synchronized boolean requestSplit(final HRegion r) {
     // don't split regions that are blocking

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1360179&r1=1360178&r2=1360179&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Wed Jul 11 14:06:20 2012
@@ -350,7 +350,10 @@ public class  HRegionServer implements C
 
   /** region server process name */
   public static final String REGIONSERVER = "regionserver";
-
+  
+  /** region server configuration name */
+  public static final String REGIONSERVER_CONF = "regionserver_conf";
+  
   /*
    * Space is reserved in HRS constructor and then released when aborting to
    * recover from an OOME. See HBASE-706. TODO: Make this percentage of the heap
@@ -1575,6 +1578,7 @@ public class  HRegionServer implements C
         this.infoServer.addServlet("status", "/rs-status", RSStatusServlet.class);
         this.infoServer.addServlet("dump", "/dump", RSDumpServlet.class);
         this.infoServer.setAttribute(REGIONSERVER, this);
+        this.infoServer.setAttribute(REGIONSERVER_CONF, conf);
         this.infoServer.start();
         break;
       } catch (BindException e) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java?rev=1360179&r1=1360178&r2=1360179&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
Wed Jul 11 14:06:20 2012
@@ -472,7 +472,26 @@ class MemStoreFlusher extends HasThread 
       wakeupFlushThread();
     }
   }
-
+  @Override
+  public String toString() {
+    return "flush_queue="
+        + flushQueue.size();
+  }
+  
+  public String dumpQueue() {
+    StringBuilder queueList = new StringBuilder();
+    queueList.append("Flush Queue Queue dump:\n");
+    queueList.append("  Flush Queue:\n");
+    java.util.Iterator<FlushQueueEntry> it = flushQueue.iterator();
+    
+    while(it.hasNext()){
+      queueList.append("    "+it.next().toString());
+      queueList.append("\n");
+    }
+    
+    return queueList.toString();
+  }
+  
   interface FlushQueueEntry extends Delayed {}
 
   /**

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java?rev=1360179&r1=1360178&r2=1360179&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSDumpServlet.java
Wed Jul 11 14:06:20 2012
@@ -46,6 +46,10 @@ public class RSDumpServlet extends State
     HRegionServer hrs = (HRegionServer)getServletContext().getAttribute(
         HRegionServer.REGIONSERVER);
     assert hrs != null : "No RS in context!";
+    
+    Configuration hrsconf = (Configuration)getServletContext().getAttribute(
+        HRegionServer.REGIONSERVER_CONF);
+    assert hrsconf != null : "No RS conf in context";
 
     response.setContentType("text/plain");
     OutputStream os = response.getOutputStream();
@@ -82,6 +86,30 @@ public class RSDumpServlet extends State
     long tailKb = getTailKbParam(request);
     LogMonitoring.dumpTailOfLogs(out, tailKb);
     
+    out.println("\n\nRS Queue:");
+    out.println(LINE);
+    if(isShowQueueDump(hrsconf)) {
+      dumpQueue(hrs, out);
+    } 
+    
     out.flush();
-  }  
+  }
+  
+  private boolean isShowQueueDump(Configuration conf){
+    return conf.getBoolean("hbase.regionserver.servlet.show.queuedump", true);
+  }
+    
+  private void dumpQueue(HRegionServer hrs, PrintWriter out)
+      throws IOException {
+    // 1. Print out Compaction/Split Queue
+    out.println("Compaction/Split Queue summary: " 
+        + hrs.compactSplitThread.toString() );
+    out.println(hrs.compactSplitThread.dumpQueue());
+
+    // 2. Print out flush Queue
+    out.println("\nFlush Queue summary: "
+        + hrs.cacheFlusher.toString());
+    out.println(hrs.cacheFlusher.dumpQueue());
+  }
+  
 }



Mime
View raw message