From 82847f3888667875df1720a219f6e55538f6ddbe Mon Sep 17 00:00:00 2001 From: xieyupei Date: Sun, 23 Jul 2023 15:43:47 +0800 Subject: [PATCH 1/2] HBASE-27717 Add rsgroup name for dead region servers on master UI --- .../hbase/tmpl/master/MasterStatusTmpl.jamon | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 1fd277fda2ae..6a6aa20c1eeb 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -52,6 +52,7 @@ org.apache.hadoop.hbase.master.RegionState; org.apache.hadoop.hbase.master.ServerManager; org.apache.hadoop.hbase.quotas.QuotaUtil; org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager; +org.apache.hadoop.hbase.rsgroup.RSGroupInfo; org.apache.hadoop.hbase.rsgroup.RSGroupUtil; org.apache.hadoop.hbase.security.access.PermissionStorage; org.apache.hadoop.hbase.security.visibility.VisibilityConstants; @@ -698,17 +699,37 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); ServerName Stop time + <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %> + <%if RSGroupUtil.isRSGroupEnabled(master.getConfiguration()) %> + RSGroup + + <%java> - DeadServer deadServerUtil = master.getServerManager().getDeadServers(); - ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]); - Arrays.sort(deadServerNames); - for (ServerName deadServerName: deadServerNames) { + RSGroupInfoManager inMgr = null; + DeadServer deadServerUtil = master.getServerManager().getDeadServers(); + ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]); + Arrays.sort(deadServerNames); + if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null + && RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) { + inMgr = master.getRSGroupInfoManager(); + } + for (ServerName deadServerName: deadServerNames) { + String rsGroupName = "default"; + if (inMgr != null){ + RSGroupInfo groupInfo = inMgr.getRSGroupOfServer(deadServerName.getAddress()); + rsGroupName = (groupInfo == null ? "default" : groupInfo.getName()); + } <% deadServerName %> <% deadServerUtil.getTimeOfDeath(deadServerName) %> + <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %> + <%if RSGroupUtil.isRSGroupEnabled(master.getConfiguration()) %> + <% rsGroupName %> + + <%java> } From f96839e258338bd51f9dd13192f516e787cccea3 Mon Sep 17 00:00:00 2001 From: xieyupei Date: Sun, 23 Jul 2023 23:08:42 +0800 Subject: [PATCH 2/2] fix code to make it compliant --- .../hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 6a6aa20c1eeb..dd10be45c936 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -715,20 +715,18 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); inMgr = master.getRSGroupInfoManager(); } for (ServerName deadServerName: deadServerNames) { - String rsGroupName = "default"; + String rsGroupName = null; if (inMgr != null){ RSGroupInfo groupInfo = inMgr.getRSGroupOfServer(deadServerName.getAddress()); - rsGroupName = (groupInfo == null ? "default" : groupInfo.getName()); + rsGroupName = groupInfo == null ? RSGroupInfo.DEFAULT_GROUP : groupInfo.getName(); } <% deadServerName %> <% deadServerUtil.getTimeOfDeath(deadServerName) %> - <%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %> - <%if RSGroupUtil.isRSGroupEnabled(master.getConfiguration()) %> - <% rsGroupName %> - + <%if rsGroupName != null %> + <% rsGroupName %> <%java>