Skip to content

Commit

Permalink
HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) (
Browse files Browse the repository at this point in the history
apache#682)

Signed-off-by: Toshihiro Suzuki <[email protected]>
  • Loading branch information
Karthik Palanisamy authored and Guanghao Zhang committed Oct 16, 2019
1 parent a0cee2c commit 96c1630
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ ServerManager serverManager;
<%java>
List<RSGroupInfo> groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection());
</%java>

<%if (groups != null && groups.size() > 0)%>

<%java>
Expand Down Expand Up @@ -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;
Expand All @@ -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>
Expand Down Expand Up @@ -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;
Expand All @@ -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>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ HMaster master;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
</%import>


<%if (servers != null && servers.size() > 0)%>

<%java>
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Loading

0 comments on commit 96c1630

Please sign in to comment.