hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [12/50] [abbrv] hbase git commit: HBASE-16677 Add table size (total store file size) to table page
Date Thu, 29 Sep 2016 06:56:57 GMT
HBASE-16677 Add table size (total store file size) to table page


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

Branch: refs/heads/hbase-14439
Commit: f5351e2dbd29ab32dbd4044844feb6a94d9fea98
Parents: 2765b9d
Author: chenheng <chenheng@apache.org>
Authored: Sun Sep 25 09:49:50 2016 +0800
Committer: chenheng <chenheng@apache.org>
Committed: Sun Sep 25 09:49:50 2016 +0800

----------------------------------------------------------------------
 .../resources/hbase-webapps/master/table.jsp    | 50 +++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f5351e2d/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 27388e7..86b70c7 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -73,6 +73,25 @@
   }
   String action = request.getParameter("action");
   String key = request.getParameter("key");
+  long totalStoreFileSizeMB = 0;
+
+  final String numRegionsParam = request.getParameter("numRegions");
+  // By default, the page render up to 10000 regions to improve the page load time
+  int numRegionsToRender = 10000;
+  if (numRegionsParam != null) {
+    // either 'all' or a number
+    if (numRegionsParam.equals("all")) {
+      numRegionsToRender = -1;
+    } else {
+      try {
+        numRegionsToRender = Integer.parseInt(numRegionsParam);
+      } catch (NumberFormatException ex) {
+        // ignore
+      }
+    }
+  }
+  int numRegions = 0;
+
 %>
 <!--[if IE]>
 <!DOCTYPE html>
@@ -342,6 +361,7 @@ if ( fqtn != null ) {
           totalSize += regionload.getStorefileSizeMB();
           totalStoreFileCount += regionload.getStorefiles();
           totalMemSize += regionload.getMemStoreSizeMB();
+          totalStoreFileSizeMB += regionload.getStorefileSizeMB();
         } else {
           RegionLoad load0 = new RegionLoad(ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(HBaseProtos.RegionSpecifier.newBuilder().setValue(ByteString.copyFrom(regionInfo.getRegionName())).build()).build());
           regionsToLoad.put(regionInfo, load0);
@@ -547,7 +567,12 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
           });
     }
   }
-
+  numRegions = regions.size();
+  int numRegionsRendered = 0;
+  // render all regions
+  if (numRegionsToRender < 0) {
+    numRegionsToRender = numRegions;
+  }
   for (Map.Entry<HRegionInfo, RegionLoad> hriEntry : entryList) {
     HRegionInfo regionInfo = hriEntry.getKey();
     ServerName addr = regionsToServer.get(regionInfo);
@@ -583,6 +608,8 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
         }
       }
     }
+    if (numRegionsRendered < numRegionsToRender) {
+      numRegionsRendered++;
 %>
 <tr>
   <td><%= escapeXml(showWhole?Bytes.toStringBinary(regionInfo.getRegionName()):regionInfo.getEncodedName())
%></td>
@@ -616,7 +643,15 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
   %>
 </tr>
 <% } %>
++<% } %>
 </table>
+<% if (numRegions > numRegionsRendered) {
+     String allRegionsUrl = "?name=" + fqtn + "&numRegions=all";
+%>
+  <p>This table has <b><%= numRegions %></b> regions in total, in
order to improve the page load time,
+     only <b><%= numRegionsRendered %></b> regions are displayed here,
<a href="<%= allRegionsUrl %>">click
+     here</a> to see all regions.</p>
+<% } %>
 <h2>Regions by Region Server</h2>
 <%
 if (withReplica) {
@@ -656,6 +691,19 @@ if (withReplica) {
 } // end else
 %>
 
+<h2>Table Stats</h2>
+<table class="table table-striped">
+  <tr>
+    <th>Name</th>
+    <th>Value</th>
+    <th>Description</th>
+  </tr>
+  <tr>
+    <td>Size</td>
+    <td><%= StringUtils.TraditionalBinaryPrefix.long2String(totalStoreFileSizeMB
* 1024 * 1024, "B", 2)%></td>
+    <td>Total size of store files (in bytes)</td>
+  </tr>
+</table>
 
 <% if (!readOnly) { %>
 <p><hr/></p>


Mime
View raw message