This is an automated email from the ASF dual-hosted git repository. brfrn169 pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push: new 3025c42 HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) (#682) 3025c42 is described below commit 3025c4250c46ab8eeeab80c33776eef8257547af Author: Karthik Palanisamy <kpalanis...@hortonworks.com> AuthorDate: Wed Oct 9 07:30:56 2019 -0700 HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) (#682) Signed-off-by: Toshihiro Suzuki <brfrn...@gmail.com> --- .../hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon | 61 ++++++++++++++----- .../hbase/tmpl/master/RegionServerListTmpl.jamon | 65 ++++++++++++++------ .../hbase/tmpl/regionserver/RegionListTmpl.jamon | 52 ++++++++++++---- .../resources/hbase-webapps/master/rsgroup.jsp | 69 ++++++++++++++++------ .../main/resources/hbase-webapps/master/table.jsp | 56 ++++++++++++++---- 5 files changed, 233 insertions(+), 70 deletions(-) diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon index 41fe487..61ddf09 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon @@ -42,7 +42,6 @@ ServerManager serverManager; <%java> List<RSGroupInfo> groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection()); </%java> - <%if (groups != null && groups.size() > 0)%> <%java> @@ -170,6 +169,10 @@ if (master.getServerManager() != null) { </tr> <%java> + final String ZEROMB = "0 MB"; + String usedHeapStr = ZEROMB; + String maxHeapStr = ZEROMB; + String memstoreSizeStr = ZEROMB; for (RSGroupInfo rsGroupInfo: rsGroupInfos) { String rsGroupName = rsGroupInfo.getName(); long usedHeap = 0; @@ -184,15 +187,25 @@ if (master.getServerManager() != null) { rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)).sum(); } } + + if (usedHeap > 0) { + usedHeapStr = TraditionalBinaryPrefix.long2String(usedHeap + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (maxHeap > 0) { + maxHeapStr = TraditionalBinaryPrefix.long2String(maxHeap + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (memstoreSize > 0) { + memstoreSizeStr = TraditionalBinaryPrefix.long2String(memstoreSize + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } </%java> <tr> <td><& rsGroupLink; rsGroupName=rsGroupName; &></td> - <td><% TraditionalBinaryPrefix.long2String(usedHeap - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String(maxHeap - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String(memstoreSize - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> + <td><% usedHeapStr %></td> + <td><% maxHeapStr %></td> + <td><% memstoreSizeStr %></td> </tr> <%java> @@ -259,6 +272,12 @@ if (master.getServerManager() != null) { <th>Bloom Size</th> </tr> <%java> + final String ZEROKB = "0 KB"; + final String ZEROMB = "0 MB"; + String uncompressedStorefileSizeStr = ZEROMB; + String storefileSizeStr = ZEROMB; + String indexSizeStr = ZEROKB; + String bloomSizeStr = ZEROKB; for (RSGroupInfo rsGroupInfo: rsGroupInfos) { String rsGroupName = rsGroupInfo.getName(); int numStores = 0; @@ -282,19 +301,31 @@ if (master.getServerManager() != null) { count++; } } + if (uncompressedStorefileSize > 0) { + uncompressedStorefileSizeStr = TraditionalBinaryPrefix. + long2String(uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (storefileSize > 0) { + storefileSizeStr = TraditionalBinaryPrefix. + long2String(storefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (indexSize > 0) { + indexSizeStr = TraditionalBinaryPrefix. + long2String(indexSize * TraditionalBinaryPrefix.KILO.value, "B", 1); + } + if (bloomSize > 0) { + bloomSizeStr = TraditionalBinaryPrefix. + long2String(bloomSize * TraditionalBinaryPrefix.KILO.value, "B", 1); + } </%java> <tr> <td><& rsGroupLink; rsGroupName=rsGroupName; &></td> <td><% numStores %></td> <td><% numStorefiles %></td> -<td><% TraditionalBinaryPrefix.long2String( - uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String( - storefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String( - indexSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String( - bloomSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> +<td><% uncompressedStorefileSizeStr %></td> +<td><% storefileSizeStr %></td> +<td><% indexSizeStr %></td> +<td><% bloomSizeStr %></td> </tr> <%java> } diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon index 1346ce8..5ce19ab 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon @@ -37,7 +37,6 @@ HMaster master; org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; </%import> - <%if (servers != null && servers.size() > 0)%> <%java> @@ -162,24 +161,38 @@ Arrays.sort(serverNames); </thead> <tbody> <%java> +final String ZEROMB = "0 MB"; +String usedHeapStr = ZEROMB; +String maxHeapStr = ZEROMB; +String memStoreSizeMBStr = ZEROMB; for (ServerName serverName: serverNames) { - ServerMetrics sl = master.getServerManager().getLoad(serverName); if (sl != null) { long memStoreSizeMB = 0; for (RegionMetrics rl : sl.getRegionMetrics().values()) { memStoreSizeMB += rl.getMemStoreSize().get(Size.Unit.MEGABYTE); } + if (memStoreSizeMB > 0) { + memStoreSizeMBStr = TraditionalBinaryPrefix.long2String(memStoreSizeMB + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + + double usedHeapSizeMB = sl.getUsedHeapSize().get(Size.Unit.MEGABYTE); + if (usedHeapSizeMB > 0) { + usedHeapStr = TraditionalBinaryPrefix.long2String((long) usedHeapSizeMB + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + double maxHeapSizeMB = sl.getMaxHeapSize().get(Size.Unit.MEGABYTE); + if (maxHeapSizeMB > 0) { + maxHeapStr = TraditionalBinaryPrefix.long2String((long) maxHeapSizeMB + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } </%java> <tr> <td><& serverNameLink; serverName=serverName; &></td> - <td><% TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String(memStoreSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - + <td><% usedHeapStr %></td> + <td><% maxHeapStr %></td> + <td><% memStoreSizeMBStr %></td> </tr> <%java> } else { @@ -261,6 +274,12 @@ if (sl != null) { </thead> <tbody> <%java> +final String ZEROKB = "0 KB"; +final String ZEROMB = "0 MB"; +String storeUncompressedSizeMBStr = ZEROMB; +String storeFileSizeMBStr = ZEROMB; +String totalStaticIndexSizeKBStr = ZEROKB; +String totalStaticBloomSizeKBStr = ZEROKB; for (ServerName serverName: serverNames) { ServerMetrics sl = master.getServerManager().getLoad(serverName); @@ -279,19 +298,31 @@ if (sl != null) { totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticBloomSizeKB += rl.getBloomFilterSize().get(Size.Unit.KILOBYTE); } + if (storeUncompressedSizeMB > 0) { + storeUncompressedSizeMBStr = TraditionalBinaryPrefix. + long2String(storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (storeFileSizeMB > 0) { + storeFileSizeMBStr = TraditionalBinaryPrefix. + long2String(storeFileSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (totalStaticIndexSizeKB > 0) { + totalStaticIndexSizeKBStr = TraditionalBinaryPrefix. + long2String(totalStaticIndexSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); + } + if (totalStaticBloomSizeKB > 0) { + totalStaticBloomSizeKBStr = TraditionalBinaryPrefix. + long2String(totalStaticBloomSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); + } </%java> <tr> <td><& serverNameLink; serverName=serverName; &></td> <td><% String.format("%,d", storeCount) %></td> <td><% String.format("%,d", storeFileCount) %></td> -<td><% TraditionalBinaryPrefix.long2String( - storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String(storeFileSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String(totalStaticIndexSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> -<td><% TraditionalBinaryPrefix.long2String(totalStaticBloomSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> +<td><% storeUncompressedSizeMBStr %></td> +<td><% storeFileSizeMBStr %></td> +<td><% totalStaticIndexSizeKBStr %></td> +<td><% totalStaticBloomSizeKBStr %></td> </tr> <%java> } else { diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon index 066fe53..1a73394 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon @@ -176,22 +176,46 @@ <tr> <%java> + final String ZEROMB = "0 MB"; + final String ZEROKB = "0 KB"; + String uncompressedStorefileSizeStr = ZEROMB; + String storefileSizeStr = ZEROMB; + String indexSizeStr = ZEROKB; + String bloomSizeStr = ZEROKB; RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, regionServer.getConfiguration()); + if (load != null) { + long uncompressedStorefileSize = load.getStoreUncompressedSizeMB(); + long storefileSize = load.getStorefileSizeMB(); + long indexSize = load.getTotalStaticIndexSizeKB(); + long bloomSize = load.getTotalStaticBloomSizeKB(); + if (uncompressedStorefileSize > 0) { + uncompressedStorefileSizeStr = TraditionalBinaryPrefix.long2String( + uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (storefileSize > 0) { + storefileSizeStr = TraditionalBinaryPrefix.long2String(storefileSize + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if(indexSize > 0) { + indexSizeStr = TraditionalBinaryPrefix.long2String(indexSize + * TraditionalBinaryPrefix.KILO.value, "B", 1); + } + if (bloomSize > 0) { + bloomSizeStr = TraditionalBinaryPrefix.long2String(bloomSize + * TraditionalBinaryPrefix.KILO.value, "B", 1); + } + } </%java> <td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td> <%if load != null %> <td><% String.format("%,1d", load.getStores()) %></td> <td><% String.format("%,1d", load.getStorefiles()) %></td> - <td><% TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB() - * TraditionalBinaryPrefix.MEGA.value, "B", 1)%></td> - <td><% TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB() - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB() - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> - <td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB() - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> + <td><% uncompressedStorefileSizeStr %></td> + <td><% storefileSizeStr %></td> + <td><% indexSizeStr %></td> + <td><% bloomSizeStr %></td> <td><% load.getDataLocality() %></td> </%if> </tr> @@ -267,14 +291,22 @@ <tr> <%java> + final String ZEROMB = "0 MB"; + String memStoreSizeMBStr = ZEROMB; RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, regionServer.getConfiguration()); + if (load != null) { + long memStoreSizeMB = load.getMemStoreSizeMB(); + if (memStoreSizeMB > 0) { + memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( + memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + } </%java> <td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td> <%if load != null %> - <td><% TraditionalBinaryPrefix.long2String( - load.getMemStoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> + <td><% memStoreSizeMBStr %></td> </%if> </tr> </%for> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp index d105e10..09d0e0b 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp @@ -55,7 +55,8 @@ <% HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); RSGroupInfo rsGroupInfo = null; - + final String ZEROKB = "0 KB"; + final String ZEROMB = "0 MB"; if (!RSGroupTableAccessor.isRSGroupsEnabled(master.getConnection())) { %> <div class="row inner_header"> @@ -211,24 +212,41 @@ <th>Max Heap</th> <th>Memstore Size</th> </tr> - <% for (Address server: rsGroupServers) { + <% + String usedHeapSizeMBStr = ZEROMB; + String maxHeapSizeMBStr = ZEROMB; + String memStoreSizeMBStr = ZEROMB; + + for (Address server: rsGroupServers) { ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { + double usedHeapSizeMB = sl.getUsedHeapSize().get(Size.Unit.MEGABYTE); + double maxHeapSizeMB = sl.getMaxHeapSize().get(Size.Unit.MEGABYTE); double memStoreSizeMB = sl.getRegionMetrics().values() .stream().mapToDouble(rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)) .sum(); int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; + + if (memStoreSizeMB > 0) { + memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( + (long) memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (usedHeapSizeMB > 0) { + usedHeapSizeMBStr = TraditionalBinaryPrefix.long2String( + (long) usedHeapSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (maxHeapSizeMB > 0) { + maxHeapSizeMBStr = TraditionalBinaryPrefix.long2String( + (long) maxHeapSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } %> <tr> <td><a href="<%= url %>"><%= serverName.getServerName() %></a></td> - <td><%= TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><%= TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><%= TraditionalBinaryPrefix.long2String((long) memStoreSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> + <td><%= usedHeapSizeMBStr %></td> + <td><%= maxHeapSizeMBStr %></td> + <td><%= memStoreSizeMBStr %></td> </tr> <% } else { %> <tr> @@ -290,7 +308,12 @@ <th>Index Size</th> <th>Bloom Size</th> </tr> - <% for (Address server: rsGroupServers) { + <% + String storeUncompressedSizeMBStr = ZEROMB; + String storeFileSizeMBStr = ZEROMB; + String totalStaticIndexSizeKBStr = ZEROKB; + String totalStaticBloomSizeKBStr = ZEROKB; + for (Address server: rsGroupServers) { ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { @@ -310,19 +333,31 @@ } int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; + if (storeUncompressedSizeMB > 0) { + storeUncompressedSizeMBStr = TraditionalBinaryPrefix.long2String( + (long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (storeFileSizeMB > 0) { + storeFileSizeMBStr = TraditionalBinaryPrefix.long2String( + (long) storeFileSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (totalStaticIndexSizeKB > 0) { + totalStaticIndexSizeKBStr = TraditionalBinaryPrefix.long2String( + (long) totalStaticIndexSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); + } + if (totalStaticBloomSizeKB > 0) { + totalStaticBloomSizeKBStr = TraditionalBinaryPrefix.long2String( + (long) totalStaticBloomSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); + } %> <tr> <td><a href="<%= url %>"><%= serverName.getServerName() %></a></td> <td><%= storeCount %></td> <td><%= storeFileCount %></td> - <td><%= TraditionalBinaryPrefix.long2String( - (long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><%= TraditionalBinaryPrefix.long2String((long) storeFileSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> - <td><%= TraditionalBinaryPrefix.long2String((long) totalStaticIndexSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> - <td><%= TraditionalBinaryPrefix.long2String((long) totalStaticBloomSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td> + <td><%= storeUncompressedSizeMBStr %></td> + <td><%= storeFileSizeMBStr %></td> + <td><%= totalStaticIndexSizeKBStr %></td> + <td><%= totalStaticBloomSizeKBStr %></td> </tr> <% } else { %> <tr> 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 d33981b..ad3de25 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -75,6 +75,8 @@ } %> <% + final String ZEROKB = "0 KB"; + final String ZEROMB = "0 MB"; HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); Configuration conf = master.getConfiguration(); String fqtn = request.getParameter("name"); @@ -205,9 +207,9 @@ if (fqtn != null && master.isInitialized()) { String hostAndPort = ""; String readReq = "N/A"; String writeReq = "N/A"; - String fileSize = "N/A"; + String fileSize = ZEROMB; String fileCount = "N/A"; - String memSize = "N/A"; + String memSize = ZEROMB; float locality = 0.0f; if (metaLocation != null) { @@ -220,9 +222,15 @@ if (fqtn != null && master.isInitialized()) { RegionMetrics load = map.get(meta.getRegionName()); readReq = String.format("%,1d", load.getReadRequestCount()); writeReq = String.format("%,1d", load.getWriteRequestCount()); - fileSize = StringUtils.byteDesc((long) load.getStoreFileSize().get(Size.Unit.BYTE)); + double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); + if (rSize > 0) { + fileSize = StringUtils.byteDesc((long) rSize); + } fileCount = String.format("%,1d", load.getStoreFileCount()); - memSize = StringUtils.byteDesc((long) load.getMemStoreSize().get(Size.Unit.BYTE)); + double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); + if (mSize > 0) { + memSize = StringUtils.byteDesc((long)mSize); + } locality = load.getDataLocality(); } } @@ -427,6 +435,8 @@ if (fqtn != null && master.isInitialized()) { long totalSize = 0; long totalStoreFileCount = 0; long totalMemSize = 0; + String totalMemSizeStr = ZEROMB; + String totalSizeStr = ZEROMB; String urlRegionServer = null; Map<ServerName, Integer> regDistribution = new TreeMap<>(); Map<ServerName, Integer> primaryRegDistribution = new TreeMap<>(); @@ -463,6 +473,12 @@ if (fqtn != null && master.isInitialized()) { regionsToLoad.put(regionInfo, load0); } } + if (totalSize > 0) { + totalSizeStr = StringUtils.byteDesc(totalSize*1024l*1024); + } + if (totalMemSize > 0) { + totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024); + } if(regions != null && regions.size() > 0) { %> <h2>Table Regions</h2> @@ -473,9 +489,9 @@ if (fqtn != null && master.isInitialized()) { <th>Region Server</th> <th>ReadRequests<br>(<%= String.format("%,1d", totalReadReq)%>)</th> <th>WriteRequests<br>(<%= String.format("%,1d", totalWriteReq)%>)</th> -<th>StorefileSize<br>(<%= StringUtils.byteDesc(totalSize*1024l*1024)%>)</th> +<th>StorefileSize<br>(<%= totalSizeStr %>)</th> <th>Num.Storefiles<br>(<%= String.format("%,1d", totalStoreFileCount)%>)</th> -<th>MemSize<br>(<%= StringUtils.byteDesc(totalMemSize*1024l*1024)%>)</th> +<th>MemSize<br>(<%= totalMemSizeStr %>)</th> <th>Locality</th> <th>Start Key</th> <th>End Key</th> @@ -504,16 +520,22 @@ if (fqtn != null && master.isInitialized()) { RegionMetrics load = hriEntry.getValue(); String readReq = "N/A"; String writeReq = "N/A"; - String regionSize = "N/A"; + String regionSize = ZEROMB; String fileCount = "N/A"; - String memSize = "N/A"; + String memSize = ZEROMB; float locality = 0.0f; if(load != null) { readReq = String.format("%,1d", load.getReadRequestCount()); writeReq = String.format("%,1d", load.getWriteRequestCount()); - regionSize = StringUtils.byteDesc((long) load.getStoreFileSize().get(Size.Unit.BYTE)); + double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); + if (rSize > 0) { + regionSize = StringUtils.byteDesc((long)rSize); + } fileCount = String.format("%,1d", load.getStoreFileCount()); - memSize = StringUtils.byteDesc((long) load.getMemStoreSize().get(Size.Unit.BYTE)); + double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); + if (mSize > 0) { + memSize = StringUtils.byteDesc((long)mSize); + } locality = load.getDataLocality(); } @@ -630,7 +652,19 @@ if (withReplica) { </tr> <tr> <td>Size</td> - <td><%= StringUtils.TraditionalBinaryPrefix.long2String(totalStoreFileSizeMB * 1024 * 1024, "B", 2)%></td> + <td> + <% + if (totalStoreFileSizeMB > 0) { + %> + <%= StringUtils.TraditionalBinaryPrefix. + long2String(totalStoreFileSizeMB * 1024 * 1024, "B", 2)%></td> + <% + } else { + %> + 0 MB </td> + <% + } + %> <td>Total size of store files</td> </tr> </table>