You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zg...@apache.org on 2020/05/18 01:46:00 UTC

[hbase] branch branch-2.2 updated: HBASE-24381 The Size metrics in Master Webui is wrong if the size is 0 (#1723)

This is an automated email from the ASF dual-hosted git repository.

zghao pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 414322e  HBASE-24381 The Size metrics in Master Webui is wrong if the size is 0 (#1723)
414322e is described below

commit 414322e072e2e2a40c9e9c80a0a06cc3edfb74d9
Author: Baiqiang Zhao <zb...@gmail.com>
AuthorDate: Mon May 18 09:14:36 2020 +0800

    HBASE-24381 The Size metrics in Master Webui is wrong if the size is 0 (#1723)
---
 .../hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon |  14 +--
 .../hbase/tmpl/master/RegionServerListTmpl.jamon   | 130 ++++++++++-----------
 .../resources/hbase-webapps/master/rsgroup.jsp     |  15 ++-
 3 files changed, 79 insertions(+), 80 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 7f15aa6..2db9f3c 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
@@ -171,10 +171,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 usedHeapStr = ZEROMB;
+      String maxHeapStr = ZEROMB;
+      String memstoreSizeStr = ZEROMB;
       String rsGroupName = rsGroupInfo.getName();
       long usedHeap = 0;
       long maxHeap = 0;
@@ -275,11 +275,11 @@ if (master.getServerManager() != null) {
 <%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 uncompressedStorefileSizeStr = ZEROMB;
+      String storefileSizeStr = ZEROMB;
+      String indexSizeStr = ZEROKB;
+      String bloomSizeStr = ZEROKB;
       String rsGroupName = rsGroupInfo.getName();
       int numStores = 0;
       long numStorefiles = 0;
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 f62788f..db1724a 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
@@ -162,31 +162,31 @@ Arrays.sort(serverNames);
 <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);
-      }
+  String usedHeapStr = ZEROMB;
+  String maxHeapStr = ZEROMB;
+  String memStoreSizeMBStr = ZEROMB;
+  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>
@@ -195,11 +195,11 @@ for (ServerName serverName: serverNames) {
     <td><% memStoreSizeMBStr %></td>
 </tr>
 <%java>
-        }  else {
+  } else {
 </%java>
 <& emptyStat; serverName=serverName; &>
 <%java>
-        }
+  }
 }
 </%java>
 </tbody>
@@ -276,44 +276,44 @@ 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);
-if (sl != null) {
-  long storeCount = 0;
-  long storeFileCount = 0;
-  long storeUncompressedSizeMB = 0;
-  long storeFileSizeMB = 0;
-  long totalStaticIndexSizeKB = 0;
-  long totalStaticBloomSizeKB = 0;
-  for (RegionMetrics rl : sl.getRegionMetrics().values()) {
-    storeCount += rl.getStoreCount();
-    storeFileCount += rl.getStoreFileCount();
-    storeUncompressedSizeMB += rl.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
-    storeFileSizeMB += rl.getStoreFileSize().get(Size.Unit.MEGABYTE);
-    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);
-  }
+  String storeUncompressedSizeMBStr = ZEROMB;
+  String storeFileSizeMBStr = ZEROMB;
+  String totalStaticIndexSizeKBStr = ZEROKB;
+  String totalStaticBloomSizeKBStr = ZEROKB;
+  ServerMetrics sl = master.getServerManager().getLoad(serverName);
+  if (sl != null) {
+    long storeCount = 0;
+    long storeFileCount = 0;
+    long storeUncompressedSizeMB = 0;
+    long storeFileSizeMB = 0;
+    long totalStaticIndexSizeKB = 0;
+    long totalStaticBloomSizeKB = 0;
+    for (RegionMetrics rl : sl.getRegionMetrics().values()) {
+      storeCount += rl.getStoreCount();
+      storeFileCount += rl.getStoreFileCount();
+      storeUncompressedSizeMB += rl.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
+      storeFileSizeMB += rl.getStoreFileSize().get(Size.Unit.MEGABYTE);
+      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>
@@ -325,11 +325,11 @@ if (sl != null) {
 <td><% totalStaticBloomSizeKBStr %></td>
 </tr>
 <%java>
-        }  else {
-        </%java>
+  } else {
+</%java>
 <& emptyStat; serverName=serverName; &>
 <%java>
-    }
+  }
 }
 </%java>
 </tbody>
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 09d0e0b..6ba6f78 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp
@@ -213,11 +213,10 @@
               <th>Memstore Size</th>
             </tr>
             <%
-               String usedHeapSizeMBStr = ZEROMB;
-               String maxHeapSizeMBStr = ZEROMB;
-               String memStoreSizeMBStr = ZEROMB;
-
                for (Address server: rsGroupServers) {
+                 String usedHeapSizeMBStr = ZEROMB;
+                 String maxHeapSizeMBStr = ZEROMB;
+                 String memStoreSizeMBStr = ZEROMB;
                  ServerName serverName = serverMaping.get(server);
                  ServerMetrics sl = onlineServers.get(server);
                  if (sl != null && serverName != null) {
@@ -309,11 +308,11 @@
                 <th>Bloom Size</th>
             </tr>
             <%
-               String storeUncompressedSizeMBStr = ZEROMB;
-               String storeFileSizeMBStr = ZEROMB;
-               String totalStaticIndexSizeKBStr = ZEROKB;
-               String totalStaticBloomSizeKBStr = ZEROKB;
                for (Address server: rsGroupServers) {
+                  String storeUncompressedSizeMBStr = ZEROMB;
+                  String storeFileSizeMBStr = ZEROMB;
+                  String totalStaticIndexSizeKBStr = ZEROKB;
+                  String totalStaticBloomSizeKBStr = ZEROKB;
                   ServerName serverName = serverMaping.get(server);
                   ServerMetrics sl = onlineServers.get(server);
                   if (sl != null && serverName != null) {