HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) (#682)

Signed-off-by: Toshihiro Suzuki <brfrn169@gmail.com>
This commit is contained in:
Karthik Palanisamy 2019-10-09 07:30:56 -07:00 committed by Toshihiro Suzuki
parent d237106ae6
commit fdac2ddc81
5 changed files with 233 additions and 70 deletions

View File

@ -42,7 +42,6 @@ ServerManager serverManager;
<%java> <%java>
List<RSGroupInfo> groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection()); List<RSGroupInfo> groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection());
</%java> </%java>
<%if (groups != null && groups.size() > 0)%> <%if (groups != null && groups.size() > 0)%>
<%java> <%java>
@ -170,6 +169,10 @@ if (master.getServerManager() != null) {
</tr> </tr>
<%java> <%java>
final String ZEROMB = "0 MB";
String usedHeapStr = ZEROMB;
String maxHeapStr = ZEROMB;
String memstoreSizeStr = ZEROMB;
for (RSGroupInfo rsGroupInfo: rsGroupInfos) { for (RSGroupInfo rsGroupInfo: rsGroupInfos) {
String rsGroupName = rsGroupInfo.getName(); String rsGroupName = rsGroupInfo.getName();
long usedHeap = 0; long usedHeap = 0;
@ -184,15 +187,25 @@ if (master.getServerManager() != null) {
rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)).sum(); 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> </%java>
<tr> <tr>
<td><& rsGroupLink; rsGroupName=rsGroupName; &></td> <td><& rsGroupLink; rsGroupName=rsGroupName; &></td>
<td><% TraditionalBinaryPrefix.long2String(usedHeap <td><% usedHeapStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% maxHeapStr %></td>
<td><% TraditionalBinaryPrefix.long2String(maxHeap <td><% memstoreSizeStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(memstoreSize
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</tr> </tr>
<%java> <%java>
@ -259,6 +272,12 @@ if (master.getServerManager() != null) {
<th>Bloom Size</th> <th>Bloom Size</th>
</tr> </tr>
<%java> <%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) { for (RSGroupInfo rsGroupInfo: rsGroupInfos) {
String rsGroupName = rsGroupInfo.getName(); String rsGroupName = rsGroupInfo.getName();
int numStores = 0; int numStores = 0;
@ -282,19 +301,31 @@ if (master.getServerManager() != null) {
count++; 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> </%java>
<tr> <tr>
<td><& rsGroupLink; rsGroupName=rsGroupName; &></td> <td><& rsGroupLink; rsGroupName=rsGroupName; &></td>
<td><% numStores %></td> <td><% numStores %></td>
<td><% numStorefiles %></td> <td><% numStorefiles %></td>
<td><% TraditionalBinaryPrefix.long2String( <td><% uncompressedStorefileSizeStr %></td>
uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% storefileSizeStr %></td>
<td><% TraditionalBinaryPrefix.long2String( <td><% indexSizeStr %></td>
storefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% bloomSizeStr %></td>
<td><% TraditionalBinaryPrefix.long2String(
indexSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(
bloomSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
</tr> </tr>
<%java> <%java>
} }

View File

@ -37,7 +37,6 @@ HMaster master;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
</%import> </%import>
<%if (servers != null && servers.size() > 0)%> <%if (servers != null && servers.size() > 0)%>
<%java> <%java>
@ -162,24 +161,38 @@ Arrays.sort(serverNames);
</thead> </thead>
<tbody> <tbody>
<%java> <%java>
final String ZEROMB = "0 MB";
String usedHeapStr = ZEROMB;
String maxHeapStr = ZEROMB;
String memStoreSizeMBStr = ZEROMB;
for (ServerName serverName: serverNames) { for (ServerName serverName: serverNames) {
ServerMetrics sl = master.getServerManager().getLoad(serverName); ServerMetrics sl = master.getServerManager().getLoad(serverName);
if (sl != null) { if (sl != null) {
long memStoreSizeMB = 0; long memStoreSizeMB = 0;
for (RegionMetrics rl : sl.getRegionMetrics().values()) { for (RegionMetrics rl : sl.getRegionMetrics().values()) {
memStoreSizeMB += rl.getMemStoreSize().get(Size.Unit.MEGABYTE); 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> </%java>
<tr> <tr>
<td><& serverNameLink; serverName=serverName; &></td> <td><& serverNameLink; serverName=serverName; &></td>
<td><% TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) <td><% usedHeapStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% maxHeapStr %></td>
<td><% TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) <td><% memStoreSizeMBStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(memStoreSizeMB
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</tr> </tr>
<%java> <%java>
} else { } else {
@ -261,6 +274,12 @@ if (sl != null) {
</thead> </thead>
<tbody> <tbody>
<%java> <%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) { for (ServerName serverName: serverNames) {
ServerMetrics sl = master.getServerManager().getLoad(serverName); ServerMetrics sl = master.getServerManager().getLoad(serverName);
@ -279,19 +298,31 @@ if (sl != null) {
totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
totalStaticBloomSizeKB += rl.getBloomFilterSize().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> </%java>
<tr> <tr>
<td><& serverNameLink; serverName=serverName; &></td> <td><& serverNameLink; serverName=serverName; &></td>
<td><% String.format("%,d", storeCount) %></td> <td><% String.format("%,d", storeCount) %></td>
<td><% String.format("%,d", storeFileCount) %></td> <td><% String.format("%,d", storeFileCount) %></td>
<td><% TraditionalBinaryPrefix.long2String( <td><% storeUncompressedSizeMBStr %></td>
storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% storeFileSizeMBStr %></td>
<td><% TraditionalBinaryPrefix.long2String(storeFileSizeMB <td><% totalStaticIndexSizeKBStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% totalStaticBloomSizeKBStr %></td>
<td><% TraditionalBinaryPrefix.long2String(totalStaticIndexSizeKB
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(totalStaticBloomSizeKB
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
</tr> </tr>
<%java> <%java>
} else { } else {

View File

@ -176,22 +176,46 @@
<tr> <tr>
<%java> <%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()); RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r,
regionServer.getConfiguration()); 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> </%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td> <td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %> <%if load != null %>
<td><% String.format("%,1d", load.getStores()) %></td> <td><% String.format("%,1d", load.getStores()) %></td>
<td><% String.format("%,1d", load.getStorefiles()) %></td> <td><% String.format("%,1d", load.getStorefiles()) %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB() <td><% uncompressedStorefileSizeStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1)%></td> <td><% storefileSizeStr %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB() <td><% indexSizeStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><% bloomSizeStr %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% load.getDataLocality() %></td> <td><% load.getDataLocality() %></td>
</%if> </%if>
</tr> </tr>
@ -267,14 +291,22 @@
<tr> <tr>
<%java> <%java>
final String ZEROMB = "0 MB";
String memStoreSizeMBStr = ZEROMB;
RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r,
regionServer.getConfiguration()); regionServer.getConfiguration());
if (load != null) {
long memStoreSizeMB = load.getMemStoreSizeMB();
if (memStoreSizeMB > 0) {
memStoreSizeMBStr = TraditionalBinaryPrefix.long2String(
memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1);
}
}
</%java> </%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td> <td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %> <%if load != null %>
<td><% TraditionalBinaryPrefix.long2String( <td><% memStoreSizeMBStr %></td>
load.getMemStoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</%if> </%if>
</tr> </tr>
</%for> </%for>

View File

@ -55,7 +55,8 @@
<% <%
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
RSGroupInfo rsGroupInfo = null; RSGroupInfo rsGroupInfo = null;
final String ZEROKB = "0 KB";
final String ZEROMB = "0 MB";
if (!RSGroupTableAccessor.isRSGroupsEnabled(master.getConnection())) { if (!RSGroupTableAccessor.isRSGroupsEnabled(master.getConnection())) {
%> %>
<div class="row inner_header"> <div class="row inner_header">
@ -211,24 +212,41 @@
<th>Max Heap</th> <th>Max Heap</th>
<th>Memstore Size</th> <th>Memstore Size</th>
</tr> </tr>
<% for (Address server: rsGroupServers) { <%
String usedHeapSizeMBStr = ZEROMB;
String maxHeapSizeMBStr = ZEROMB;
String memStoreSizeMBStr = ZEROMB;
for (Address server: rsGroupServers) {
ServerName serverName = serverMaping.get(server); ServerName serverName = serverMaping.get(server);
ServerMetrics sl = onlineServers.get(server); ServerMetrics sl = onlineServers.get(server);
if (sl != null && serverName != null) { 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() double memStoreSizeMB = sl.getRegionMetrics().values()
.stream().mapToDouble(rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)) .stream().mapToDouble(rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE))
.sum(); .sum();
int infoPort = master.getRegionServerInfoPort(serverName); int infoPort = master.getRegionServerInfoPort(serverName);
String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; 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> <tr>
<td><a href="<%= url %>"><%= serverName.getServerName() %></a></td> <td><a href="<%= url %>"><%= serverName.getServerName() %></a></td>
<td><%= TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) <td><%= usedHeapSizeMBStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><%= maxHeapSizeMBStr %></td>
<td><%= TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) <td><%= memStoreSizeMBStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><%= TraditionalBinaryPrefix.long2String((long) memStoreSizeMB
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
@ -290,7 +308,12 @@
<th>Index Size</th> <th>Index Size</th>
<th>Bloom Size</th> <th>Bloom Size</th>
</tr> </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); ServerName serverName = serverMaping.get(server);
ServerMetrics sl = onlineServers.get(server); ServerMetrics sl = onlineServers.get(server);
if (sl != null && serverName != null) { if (sl != null && serverName != null) {
@ -310,19 +333,31 @@
} }
int infoPort = master.getRegionServerInfoPort(serverName); int infoPort = master.getRegionServerInfoPort(serverName);
String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; 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> <tr>
<td><a href="<%= url %>"><%= serverName.getServerName() %></a></td> <td><a href="<%= url %>"><%= serverName.getServerName() %></a></td>
<td><%= storeCount %></td> <td><%= storeCount %></td>
<td><%= storeFileCount %></td> <td><%= storeFileCount %></td>
<td><%= TraditionalBinaryPrefix.long2String( <td><%= storeUncompressedSizeMBStr %></td>
(long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><%= storeFileSizeMBStr %></td>
<td><%= TraditionalBinaryPrefix.long2String((long) storeFileSizeMB <td><%= totalStaticIndexSizeKBStr %></td>
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td> <td><%= totalStaticBloomSizeKBStr %></td>
<td><%= TraditionalBinaryPrefix.long2String((long) totalStaticIndexSizeKB
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><%= TraditionalBinaryPrefix.long2String((long) totalStaticBloomSizeKB
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>

View File

@ -79,6 +79,8 @@
} }
%> %>
<% <%
final String ZEROKB = "0 KB";
final String ZEROMB = "0 MB";
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
Configuration conf = master.getConfiguration(); Configuration conf = master.getConfiguration();
String fqtn = request.getParameter("name"); String fqtn = request.getParameter("name");
@ -209,9 +211,9 @@ if (fqtn != null && master.isInitialized()) {
String hostAndPort = ""; String hostAndPort = "";
String readReq = "N/A"; String readReq = "N/A";
String writeReq = "N/A"; String writeReq = "N/A";
String fileSize = "N/A"; String fileSize = ZEROMB;
String fileCount = "N/A"; String fileCount = "N/A";
String memSize = "N/A"; String memSize = ZEROMB;
float locality = 0.0f; float locality = 0.0f;
if (metaLocation != null) { if (metaLocation != null) {
@ -224,9 +226,15 @@ if (fqtn != null && master.isInitialized()) {
RegionMetrics load = map.get(meta.getRegionName()); RegionMetrics load = map.get(meta.getRegionName());
readReq = String.format("%,1d", load.getReadRequestCount()); readReq = String.format("%,1d", load.getReadRequestCount());
writeReq = String.format("%,1d", load.getWriteRequestCount()); 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()); 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(); locality = load.getDataLocality();
} }
} }
@ -439,6 +447,8 @@ if (fqtn != null && master.isInitialized()) {
long totalSize = 0; long totalSize = 0;
long totalStoreFileCount = 0; long totalStoreFileCount = 0;
long totalMemSize = 0; long totalMemSize = 0;
String totalMemSizeStr = ZEROMB;
String totalSizeStr = ZEROMB;
String urlRegionServer = null; String urlRegionServer = null;
Map<ServerName, Integer> regDistribution = new TreeMap<>(); Map<ServerName, Integer> regDistribution = new TreeMap<>();
Map<ServerName, Integer> primaryRegDistribution = new TreeMap<>(); Map<ServerName, Integer> primaryRegDistribution = new TreeMap<>();
@ -475,6 +485,12 @@ if (fqtn != null && master.isInitialized()) {
regionsToLoad.put(regionInfo, load0); 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) { %> if(regions != null && regions.size() > 0) { %>
<h2>Table Regions</h2> <h2>Table Regions</h2>
@ -485,9 +501,9 @@ if (fqtn != null && master.isInitialized()) {
<th>Region Server</th> <th>Region Server</th>
<th>ReadRequests<br>(<%= String.format("%,1d", totalReadReq)%>)</th> <th>ReadRequests<br>(<%= String.format("%,1d", totalReadReq)%>)</th>
<th>WriteRequests<br>(<%= String.format("%,1d", totalWriteReq)%>)</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>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>Locality</th>
<th>Start Key</th> <th>Start Key</th>
<th>End Key</th> <th>End Key</th>
@ -517,17 +533,23 @@ if (fqtn != null && master.isInitialized()) {
RegionMetrics load = hriEntry.getValue(); RegionMetrics load = hriEntry.getValue();
String readReq = "N/A"; String readReq = "N/A";
String writeReq = "N/A"; String writeReq = "N/A";
String regionSize = "N/A"; String regionSize = ZEROMB;
String fileCount = "N/A"; String fileCount = "N/A";
String memSize = "N/A"; String memSize = ZEROMB;
float locality = 0.0f; float locality = 0.0f;
String state = "N/A"; String state = "N/A";
if(load != null) { if(load != null) {
readReq = String.format("%,1d", load.getReadRequestCount()); readReq = String.format("%,1d", load.getReadRequestCount());
writeReq = String.format("%,1d", load.getWriteRequestCount()); 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()); 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(); locality = load.getDataLocality();
} }
@ -649,7 +671,19 @@ if (withReplica) {
</tr> </tr>
<tr> <tr>
<td>Size</td> <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> <td>Total size of store files</td>
</tr> </tr>
</table> </table>