You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ha...@apache.org on 2023/03/14 03:55:27 UTC

[hbase] branch branch-2 updated: HBASE-27615 Add group of regionServer on Master webUI (#5098)

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

haxiaolin 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 24653dd1055 HBASE-27615 Add group of regionServer on Master webUI (#5098)
24653dd1055 is described below

commit 24653dd10555b58323d833932d30eb6598e37a7d
Author: tianhang <ta...@gmail.com>
AuthorDate: Tue Mar 14 11:55:18 2023 +0800

    HBASE-27615 Add group of regionServer on Master webUI (#5098)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    Signed-off-by: Xiaolin Ha <ha...@apache.org>
---
 .../hbase/tmpl/master/RegionServerListTmpl.jamon   | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

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 a7e91d9b00b..4c9140470b7 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
@@ -29,9 +29,12 @@ HMaster master;
         org.apache.hadoop.hbase.procedure2.util.StringUtils;
         org.apache.hadoop.hbase.replication.ReplicationLoadSource;
         org.apache.hadoop.hbase.RegionMetrics;
+        org.apache.hadoop.hbase.RSGroupTableAccessor;
         org.apache.hadoop.hbase.ServerMetrics;
         org.apache.hadoop.hbase.ServerName;
         org.apache.hadoop.hbase.Size;
+        org.apache.hadoop.hbase.net.Address;
+        org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
         org.apache.hadoop.hbase.util.VersionInfo;
         org.apache.hadoop.hbase.util.Pair;
         org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
@@ -91,6 +94,12 @@ Arrays.sort(serverNames);
     <th>Version</th>
     <th>Requests Per Second</th>
     <th>Num. Regions</th>
+    <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %>
+      <%if master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null &&
+        master.getServerManager().getOnlineServersList().size() > 0 %>
+        <th>RSGroup</th>
+      </%if>
+    </%if>
 </tr>
 </thead>
 <tbody>
@@ -101,6 +110,19 @@ Arrays.sort(serverNames);
     String state = "Normal";
     String masterVersion = VersionInfo.getVersion();
     Set<ServerName> decommissionedServers = new HashSet<>(master.listDecommissionedRegionServers());
+
+    String rsGroupName = "default";
+        List<RSGroupInfo> groups;
+        Map<Address, RSGroupInfo> server2GroupMap = new HashMap<>();
+        if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null
+          && master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null
+          && master.getServerManager().getOnlineServersList().size() > 0) {
+            groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection());
+            groups.forEach(group -> {
+              group.getServers().forEach(address -> server2GroupMap.put(address, group));
+            });
+        }
+
     for (ServerName serverName: serverNames) {
     if (decommissionedServers.contains(serverName)) {
         state = "Decommissioned";
@@ -123,6 +145,12 @@ Arrays.sort(serverNames);
         lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000;
     }
     long startcode = serverName.getStartcode();
+
+    if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null
+      && master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null
+      && master.getServerManager().getOnlineServersList().size() > 0) {
+        rsGroupName = server2GroupMap.get(serverName.getAddress()).getName();
+    }
 </%java>
 <tr>
     <td><& serverNameLink; serverName=serverName; &></td>
@@ -132,6 +160,12 @@ Arrays.sort(serverNames);
     <td><% version %></td>
     <td><% String.format("%,.0f", requestsPerSecond) %></td>
     <td><% String.format("%,d", numRegionsOnline) %></td>
+    <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %>
+      <%if master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null &&
+        master.getServerManager().getOnlineServersList().size() > 0 %>
+        <td><% rsGroupName %></td>
+      </%if>
+    </%if>
 </tr>
 <%java>
 }