diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java index c134063..dd55d39 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java @@ -744,6 +744,13 @@ public class HRegionInfo implements Comparable { return replicaId; } + /* + * @return true if this is the primary replica + */ + public boolean isPrimary() { + return replicaId == DEFAULT_REPLICA_ID; + } + /** * @see java.lang.Object#toString() */ 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 45be52b..e04b3bf 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 (regionInfo.isPrimary()) { + i = primaryRegDistribution.get(addr); + if (null == i) i = Integer.valueOf(0); + primaryRegDistribution.put(addr, i+1); + } } } %> @@ -341,7 +347,7 @@ if ( fqtn != null ) { <% } %>

Regions by Region Server

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