From 24653dd10555b58323d833932d30eb6598e37a7d Mon Sep 17 00:00:00 2001 From: tianhang Date: Tue, 14 Mar 2023 11:55:18 +0800 Subject: [PATCH] HBASE-27615 Add group of regionServer on Master webUI (#5098) Signed-off-by: Duo Zhang Signed-off-by: Xiaolin Ha --- .../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); Version Requests Per Second Num. Regions + <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %> + <%if master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null && + master.getServerManager().getOnlineServersList().size() > 0 %> + RSGroup + + @@ -101,6 +110,19 @@ Arrays.sort(serverNames); String state = "Normal"; String masterVersion = VersionInfo.getVersion(); Set decommissionedServers = new HashSet<>(master.listDecommissionedRegionServers()); + + String rsGroupName = "default"; + List groups; + Map 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(); + } <& serverNameLink; serverName=serverName; &> @@ -132,6 +160,12 @@ Arrays.sort(serverNames); <% version %> <% String.format("%,.0f", requestsPerSecond) %> <% String.format("%,d", numRegionsOnline) %> + <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %> + <%if master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null && + master.getServerManager().getOnlineServersList().size() > 0 %> + <% rsGroupName %> + + <%java> }