From 9f4aeca7c84d3e0c0b2067275e04c6c29ace948b Mon Sep 17 00:00:00 2001 From: tedyu Date: Wed, 29 Jul 2015 14:22:21 -0700 Subject: [PATCH] HBASE-14164 Display primary region replicas distribution on table.jsp --- .../resources/hbase-webapps/master/table.jsp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index 45be52bcfaf..418865fdaca 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -282,6 +282,7 @@ if ( fqtn != null ) { <% Map regDistribution = new TreeMap(); + Map primaryRegDistribution = new TreeMap(); List regions = r.getAllRegionLocations(); if(regions != null && regions.size() > 0) { %> <%= tableHeader %> @@ -304,6 +305,11 @@ if ( fqtn != null ) { Integer i = regDistribution.get(addr); if (null == i) i = Integer.valueOf(0); regDistribution.put(addr, i + 1); + if (withReplica && RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) { + i = primaryRegDistribution.get(addr); + if (null == i) i = Integer.valueOf(0); + primaryRegDistribution.put(addr, i+1); + } } } %> @@ -341,7 +347,17 @@ if ( fqtn != null ) { <% } %>

Regions by Region Server

+<% +if (withReplica) { +%> + +<% +} else { +%>
Region ServerRegion CountPrimary Region Count
+<% +} +%> <% for (Map.Entry rdEntry : regDistribution.entrySet()) { ServerName addr = rdEntry.getKey(); @@ -350,6 +366,13 @@ if ( fqtn != null ) { +<% +if (withReplica) { +%> + +<% +} +%> <% } %>
Region ServerRegion Count
<%= addr.getHostname().toString() + ":" + addr.getPort() %> <%= rdEntry.getValue()%><%= primaryRegDistribution.get(addr)%>