Skip to content

Commit 0491524

Browse files
authored
HBASE-27615 Add group of regionServer on Master webUI (#5010)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
1 parent bc8b13e commit 0491524

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ HMaster master;
3535
org.apache.hadoop.hbase.util.VersionInfo;
3636
org.apache.hadoop.hbase.util.Pair;
3737
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
38+
org.apache.hadoop.hbase.net.Address;
39+
org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
40+
org.apache.hadoop.hbase.rsgroup.RSGroupUtil;
3841
</%import>
3942

4043
<%if (servers != null && servers.size() > 0)%>
@@ -91,6 +94,11 @@ Arrays.sort(serverNames);
9194
<th>Version</th>
9295
<th>Requests Per Second</th>
9396
<th>Num. Regions</th>
97+
<%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %>
98+
<%if RSGroupUtil.isRSGroupEnabled(master.getConfiguration()) %>
99+
<th style="vertical-align: middle;" rowspan="2">RSGroup</th>
100+
</%if>
101+
</%if>
94102
</tr>
95103
</thead>
96104
<tbody>
@@ -101,6 +109,16 @@ Arrays.sort(serverNames);
101109
String state = "Normal";
102110
String masterVersion = VersionInfo.getVersion();
103111
Set<ServerName> decommissionedServers = new HashSet<>(master.listDecommissionedRegionServers());
112+
String rsGroupName = "default";
113+
List<RSGroupInfo> groups;
114+
Map<Address, RSGroupInfo> server2GroupMap = new HashMap<>();
115+
if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null
116+
&& RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) {
117+
groups = master.getRSGroupInfoManager().listRSGroups();
118+
groups.forEach(group -> {
119+
group.getServers().forEach(address -> server2GroupMap.put(address, group));
120+
});
121+
}
104122
for (ServerName serverName: serverNames) {
105123
if (decommissionedServers.contains(serverName)) {
106124
state = "Decommissioned";
@@ -123,6 +141,10 @@ Arrays.sort(serverNames);
123141
lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000;
124142
}
125143
long startcode = serverName.getStartcode();
144+
if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null
145+
&& RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) {
146+
rsGroupName = server2GroupMap.get(serverName.getAddress()).getName();
147+
}
126148
</%java>
127149
<tr>
128150
<td><& serverNameLink; serverName=serverName; &></td>
@@ -132,6 +154,11 @@ Arrays.sort(serverNames);
132154
<td><% version %></td>
133155
<td><% String.format("%,.0f", requestsPerSecond) %></td>
134156
<td><% String.format("%,d", numRegionsOnline) %></td>
157+
<%if !master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null %>
158+
<%if RSGroupUtil.isRSGroupEnabled(master.getConfiguration()) %>
159+
<td><% rsGroupName %></td>
160+
</%if>
161+
</%if>
135162
</tr>
136163
<%java>
137164
}

0 commit comments

Comments
 (0)