From 27aee5c8be570e59c8106dab49c82331af69923f Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Wed, 2 Oct 2019 15:30:49 -0700 Subject: [PATCH 1/5] HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) --- .../resources/hbase-webapps/master/table.jsp | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) 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 96ad9c3930f1..a4cab5a070b7 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -485,9 +485,31 @@ if (fqtn != null && master.isInitialized()) { Region Server ReadRequests
(<%= String.format("%,1d", totalReadReq)%>) WriteRequests
(<%= String.format("%,1d", totalWriteReq)%>) -StorefileSize
(<%= StringUtils.byteDesc(totalSize*1024l*1024)%>) +StorefileSize
+ <% + if (totalSize > 0) { + %> + (<%= StringUtils.byteDesc(totalSize*1024l*1024)%>) + <% + } else { + %> + (<%= "0 MB" %>) + <% + } + %> Num.Storefiles
(<%= String.format("%,1d", totalStoreFileCount)%>) -MemSize
(<%= StringUtils.byteDesc(totalMemSize*1024l*1024)%>) +MemSize
+ <% + if (totalMemSize > 0) { + %> + (<%= StringUtils.byteDesc(totalMemSize*1024l*1024)%>) + <% + } else { + %> + (<%= "0 MB" %>) + <% + } + %> Locality Start Key End Key @@ -525,9 +547,19 @@ if (fqtn != null && master.isInitialized()) { 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); + } else { + regionSize = "0 MB"; + } 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); + } else { + memSize = "0 MB"; + } locality = load.getDataLocality(); } From 5dab5f831f46ca932ab2f9f0946e6b955243fef3 Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Wed, 2 Oct 2019 21:57:19 -0700 Subject: [PATCH 2/5] HBASE-23115 Unit change for StoreFileSize and MemstoreSize (table.jsp) --- .../main/resources/hbase-webapps/master/table.jsp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 a4cab5a070b7..2ac61c48c873 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -681,7 +681,19 @@ if (withReplica) { Size - <%= StringUtils.TraditionalBinaryPrefix.long2String(totalStoreFileSizeMB * 1024 * 1024, "B", 2)%> + + <% + if (totalStoreFileSizeMB > 0) { + %> + <%= StringUtils.TraditionalBinaryPrefix. + long2String(totalStoreFileSizeMB * 1024 * 1024, "B", 2)%> + <% + } else { + %> + 0 MB + <% + } + %> Total size of store files From 793d550aefe69825ba071fd4306ac2daaa899a1e Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Thu, 3 Oct 2019 14:42:43 -0700 Subject: [PATCH 3/5] HBASE-23115 Unit change for StoreFileSize and MemstoreSize --- .../hbase/tmpl/master/RSGroupListTmpl.jamon | 61 ++++++++++++---- .../tmpl/master/RegionServerListTmpl.jamon | 65 ++++++++++++----- .../tmpl/regionserver/RegionListTmpl.jamon | 49 ++++++++++--- .../hbase-webapps/master/rsgroup.jsp | 69 ++++++++++++++----- .../resources/hbase-webapps/master/table.jsp | 58 +++++++--------- 5 files changed, 209 insertions(+), 93 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 41fe487f0ec9..8a2000aeb3c3 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 groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection()); - <%if (groups != null && groups.size() > 0)%> <%java> @@ -170,6 +169,10 @@ if (master.getServerManager() != null) { <%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 (usedHeap > 0) { + maxHeapStr = TraditionalBinaryPrefix.long2String(maxHeap + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + if (memstoreSize > 0) { + memstoreSizeStr = TraditionalBinaryPrefix.long2String(memstoreSize + * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } <& rsGroupLink; rsGroupName=rsGroupName; &> - <% TraditionalBinaryPrefix.long2String(usedHeap - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String(maxHeap - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String(memstoreSize - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> + <% usedHeapStr %> + <% maxHeapStr %> + <% memstoreSizeStr %> <%java> @@ -282,19 +295,37 @@ if (master.getServerManager() != null) { count++; } } + final String ZEROKB = "0 KB"; + final String ZEROMB = "0 MB"; + String uncompressedStorefileSizeStr = ZEROMB; + String storefileSizeStr = ZEROMB; + String indexSizeStr = ZEROKB; + String bloomSizeStr = ZEROKB; + 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); + } <& rsGroupLink; rsGroupName=rsGroupName; &> <% numStores %> <% numStorefiles %> -<% TraditionalBinaryPrefix.long2String( - uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String( - storefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String( - indexSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String( - bloomSize * TraditionalBinaryPrefix.KILO.value, "B", 1) %> +<% uncompressedStorefileSizeStr %> +<% storefileSizeStr %> +<% indexSizeStr %> +<% bloomSizeStr %> <%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 1346ce81a775..3fd1a0c89f1c 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; - <%if (servers != null && servers.size() > 0)%> <%java> @@ -162,24 +161,38 @@ Arrays.sort(serverNames); <%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); + } <& serverNameLink; serverName=serverName; &> - <% TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String(memStoreSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - + <% usedHeapStr %> + <% maxHeapStr %> + <% memStoreSizeMBStr %> <%java> } else { @@ -279,19 +292,37 @@ if (sl != null) { totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticBloomSizeKB += rl.getBloomFilterSize().get(Size.Unit.KILOBYTE); } + final String ZEROKB = "0 KB"; + final String ZEROMB = "0 MB"; + String storeUncompressedSizeMBStr = ZEROMB; + String storeFileSizeMBStr = ZEROMB; + String totalStaticIndexSizeKBStr = ZEROKB; + String totalStaticBloomSizeKBStr = ZEROKB; + 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); + } <& serverNameLink; serverName=serverName; &> <% String.format("%,d", storeCount) %> <% String.format("%,d", storeFileCount) %> -<% TraditionalBinaryPrefix.long2String( - storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String(storeFileSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String(totalStaticIndexSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> -<% TraditionalBinaryPrefix.long2String(totalStaticBloomSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> +<% storeUncompressedSizeMBStr %> +<% storeFileSizeMBStr %> +<% totalStaticIndexSizeKBStr %> +<% totalStaticBloomSizeKBStr %> <%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 066fe53b4c53..8df612a67918 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 @@ -179,19 +179,41 @@ RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, regionServer.getConfiguration()); + long uncompressedStorefileSize = load.getStoreUncompressedSizeMB(); + long storefileSize = load.getStorefileSizeMB(); + long indexSize = load.getTotalStaticIndexSizeKB(); + long bloomSize = load.getTotalStaticBloomSizeKB(); + final String ZEROMB = "0 MB"; + final String ZEROKB = "0 KB"; + String uncompressedStorefileSizeStr = ZEROMB; + String storefileSizeStr = ZEROMB; + String indexSizeStr = ZEROKB; + String bloomSizeStr = ZEROKB; + 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); + } <% displayName %> <%if load != null %> <% String.format("%,1d", load.getStores()) %> <% String.format("%,1d", load.getStorefiles()) %> - <% TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB() - * TraditionalBinaryPrefix.MEGA.value, "B", 1)%> - <% TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB() - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB() - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> - <% TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB() - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> + <% uncompressedStorefileSizeStr %> + <% storefileSizeStr %> + <% indexSizeStr %> + <% bloomSizeStr %> <% load.getDataLocality() %> @@ -270,11 +292,18 @@ RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, regionServer.getConfiguration()); + final String ZEROMB = "0 MB"; + String memStoreSizeMBStr = ZEROMB; + long memStoreSizeMB = load.getMemStoreSizeMB(); + if (memStoreSizeMB > 0) { + memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( + memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + <% displayName %> <%if load != null %> - <% TraditionalBinaryPrefix.long2String( - load.getMemStoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> + <% memStoreSizeMBStr %> 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 0b9165b78f78..0e5d6ac49ef2 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())) { %>
@@ -211,24 +212,41 @@ Max Heap Memstore Size - <% 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); + } %> <%= serverName.getServerName() %> - <%= TraditionalBinaryPrefix.long2String((long) sl.getUsedHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <%= TraditionalBinaryPrefix.long2String((long) sl.getMaxHeapSize().get(Size.Unit.MEGABYTE) - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <%= TraditionalBinaryPrefix.long2String((long) memStoreSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> + <%= usedHeapSizeMBStr %> + <%= maxHeapSizeMBStr %> + <%= memStoreSizeMBStr %> <% } else { %> @@ -290,7 +308,12 @@ Index Size Bloom Size - <% 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); + } %> <%= serverName.getServerName() %> <%= storeCount %> <%= storeFileCount %> - <%= TraditionalBinaryPrefix.long2String( - (long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <%= TraditionalBinaryPrefix.long2String((long) storeFileSizeMB - * TraditionalBinaryPrefix.MEGA.value, "B", 1) %> - <%= TraditionalBinaryPrefix.long2String((long) totalStaticIndexSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> - <%= TraditionalBinaryPrefix.long2String((long) totalStaticBloomSizeKB - * TraditionalBinaryPrefix.KILO.value, "B", 1) %> + <%= storeUncompressedSizeMBStr %> + <%= storeFileSizeMBStr %> + <%= totalStaticIndexSizeKBStr %> + <%= totalStaticBloomSizeKBStr %> <% } else { %> 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 2ac61c48c873..5acfb74dd1e7 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -79,6 +79,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"); @@ -209,9 +211,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) { @@ -224,9 +226,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(); } } @@ -439,6 +447,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 regDistribution = new TreeMap<>(); Map primaryRegDistribution = new TreeMap<>(); @@ -475,6 +485,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) { %>

Table Regions

@@ -485,31 +501,9 @@ if (fqtn != null && master.isInitialized()) { Region Server ReadRequests
(<%= String.format("%,1d", totalReadReq)%>) WriteRequests
(<%= String.format("%,1d", totalWriteReq)%>) -StorefileSize
- <% - if (totalSize > 0) { - %> - (<%= StringUtils.byteDesc(totalSize*1024l*1024)%>) - <% - } else { - %> - (<%= "0 MB" %>) - <% - } - %> +StorefileSize
(<%= totalSizeStr %>) Num.Storefiles
(<%= String.format("%,1d", totalStoreFileCount)%>) -MemSize
- <% - if (totalMemSize > 0) { - %> - (<%= StringUtils.byteDesc(totalMemSize*1024l*1024)%>) - <% - } else { - %> - (<%= "0 MB" %>) - <% - } - %> +MemSize
(<%= totalMemSizeStr %>) Locality Start Key End Key @@ -539,9 +533,9 @@ 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; String state = "N/A"; if(load != null) { @@ -550,15 +544,11 @@ if (fqtn != null && master.isInitialized()) { double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); if (rSize > 0) { regionSize = StringUtils.byteDesc((long)rSize); - } else { - regionSize = "0 MB"; } fileCount = String.format("%,1d", load.getStoreFileCount()); double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); if (mSize > 0) { memSize = StringUtils.byteDesc((long)mSize); - } else { - memSize = "0 MB"; } locality = load.getDataLocality(); } From 748db27f459dbaf5668b78e673f359f634f6a8db Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Thu, 3 Oct 2019 15:33:52 -0700 Subject: [PATCH 4/5] HBASE-23115 Unit change for StoreFileSize and MemstoreSize --- .../org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8a2000aeb3c3..e21d3b62a317 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 @@ -192,7 +192,7 @@ if (master.getServerManager() != null) { usedHeapStr = TraditionalBinaryPrefix.long2String(usedHeap * TraditionalBinaryPrefix.MEGA.value, "B", 1); } - if (usedHeap > 0) { + if (maxHeap > 0) { maxHeapStr = TraditionalBinaryPrefix.long2String(maxHeap * TraditionalBinaryPrefix.MEGA.value, "B", 1); } From 54557bab2dbe088cf7c95111a28fe84161411b77 Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Fri, 4 Oct 2019 00:19:16 -0700 Subject: [PATCH 5/5] Null Check --- .../hbase/tmpl/master/RSGroupListTmpl.jamon | 12 ++++----- .../tmpl/master/RegionServerListTmpl.jamon | 12 ++++----- .../tmpl/regionserver/RegionListTmpl.jamon | 25 +++++++++++-------- 3 files changed, 26 insertions(+), 23 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 e21d3b62a317..61ddf09905d2 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 @@ -272,6 +272,12 @@ if (master.getServerManager() != null) { Bloom Size <%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; @@ -295,12 +301,6 @@ if (master.getServerManager() != null) { count++; } } - final String ZEROKB = "0 KB"; - final String ZEROMB = "0 MB"; - String uncompressedStorefileSizeStr = ZEROMB; - String storefileSizeStr = ZEROMB; - String indexSizeStr = ZEROKB; - String bloomSizeStr = ZEROKB; if (uncompressedStorefileSize > 0) { uncompressedStorefileSizeStr = TraditionalBinaryPrefix. long2String(uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); 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 3fd1a0c89f1c..5ce19ab7b0f4 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 @@ -274,6 +274,12 @@ if (sl != null) { <%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); @@ -292,12 +298,6 @@ if (sl != null) { totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticBloomSizeKB += rl.getBloomFilterSize().get(Size.Unit.KILOBYTE); } - final String ZEROKB = "0 KB"; - final String ZEROMB = "0 MB"; - String storeUncompressedSizeMBStr = ZEROMB; - String storeFileSizeMBStr = ZEROMB; - String totalStaticIndexSizeKBStr = ZEROKB; - String totalStaticBloomSizeKBStr = ZEROKB; if (storeUncompressedSizeMB > 0) { storeUncompressedSizeMBStr = TraditionalBinaryPrefix. long2String(storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); 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 8df612a67918..1a73394a2125 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,19 +176,20 @@ <%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(); - final String ZEROMB = "0 MB"; - final String ZEROKB = "0 KB"; - String uncompressedStorefileSizeStr = ZEROMB; - String storefileSizeStr = ZEROMB; - String indexSizeStr = ZEROKB; - String bloomSizeStr = ZEROKB; if (uncompressedStorefileSize > 0) { uncompressedStorefileSizeStr = TraditionalBinaryPrefix.long2String( uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); @@ -204,7 +205,8 @@ if (bloomSize > 0) { bloomSizeStr = TraditionalBinaryPrefix.long2String(bloomSize * TraditionalBinaryPrefix.KILO.value, "B", 1); - } + } + } <% displayName %> <%if load != null %> @@ -289,17 +291,18 @@ <%java> + final String ZEROMB = "0 MB"; + String memStoreSizeMBStr = ZEROMB; RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, regionServer.getConfiguration()); - final String ZEROMB = "0 MB"; - String memStoreSizeMBStr = ZEROMB; + if (load != null) { long memStoreSizeMB = load.getMemStoreSizeMB(); if (memStoreSizeMB > 0) { memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); - } - + } + } <% displayName %> <%if load != null %>