hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r664288 - in /hadoop/hbase/trunk/src: java/org/apache/hadoop/hbase/regionserver/HRegionServer.java webapps/regionserver/regionserver.jsp
Date Sat, 07 Jun 2008 06:23:44 GMT
Author: stack
Date: Fri Jun  6 23:23:44 2008
New Revision: 664288

URL: http://svn.apache.org/viewvc?rev=664288&view=rev
Log:
HBASE-672 Sort regions in the regionserver UI

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/trunk/src/webapps/regionserver/regionserver.jsp

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=664288&r1=664287&r2=664288&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Fri
Jun  6 23:23:44 2008
@@ -37,6 +37,7 @@
 import java.util.Random;
 import java.util.Set;
 import java.util.SortedMap;
+import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.concurrent.BlockingQueue;
@@ -1309,6 +1310,19 @@
   }
 
   /**
+   * @return The HRegionInfos from online regions sorted
+   */
+  public SortedSet<HRegionInfo> getSortedOnlineRegionInfos() {
+    SortedSet<HRegionInfo> result = new TreeSet<HRegionInfo>();
+    synchronized(this.onlineRegions) {
+      for (HRegion r: this.onlineRegions.values()) {
+        result.add(r.getRegionInfo());
+      }
+    }
+    return result;
+  }
+
+  /**
    * @return A new Map of online regions sorted by region size with the first
    * entry being the biggest.
    */

Modified: hadoop/hbase/trunk/src/webapps/regionserver/regionserver.jsp
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/webapps/regionserver/regionserver.jsp?rev=664288&r1=664287&r2=664288&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/webapps/regionserver/regionserver.jsp (original)
+++ hadoop/hbase/trunk/src/webapps/regionserver/regionserver.jsp Fri Jun  6 23:23:44 2008
@@ -9,7 +9,7 @@
   import="org.apache.hadoop.hbase.HRegionInfo" %><%
   HRegionServer regionServer = (HRegionServer)getServletContext().getAttribute(HRegionServer.REGIONSERVER);
   HServerInfo serverInfo = regionServer.getServerInfo();
-  Collection<HRegion> onlineRegions = regionServer.getOnlineRegions();
+  Collection<HRegionInfo> onlineRegions = regionServer.getSortedOnlineRegionInfos();
   int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval",
3000)/1000;
 %><?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
@@ -38,8 +38,8 @@
 <% if (onlineRegions != null && onlineRegions.size() > 0) { %>
 <table>
 <tr><th>Region Name</th><th>Encoded Name</th><th>Start
Key</th><th>End Key</th></tr>
-<%   for (HRegion r: onlineRegions) { %>
-<tr><td><%= Bytes.toString(r.getRegionName()) %></td><td><%=
r.getRegionInfo().getEncodedName() %></td>
+<%   for (HRegionInfo r: onlineRegions) { %>
+<tr><td><%= r.getRegionNameAsString() %></td><td><%= r.getEncodedName()
%></td>
     <td><%= Bytes.toString(r.getStartKey()) %></td><td><%= Bytes.toString(r.getEndKey())
%></td></tr>
 <%   } %>
 </table>



Mime
View raw message