HBASE-21232 Show table state in Tables view on Master home page

This commit is contained in:
Michael Stack 2018-09-25 18:08:08 -07:00
parent d7e08317d2
commit 1154f81230
1 changed files with 7 additions and 3 deletions

View File

@ -44,6 +44,7 @@ org.apache.hadoop.hbase.ServerName;
org.apache.hadoop.hbase.TableName; org.apache.hadoop.hbase.TableName;
org.apache.hadoop.hbase.client.Admin; org.apache.hadoop.hbase.client.Admin;
org.apache.hadoop.hbase.client.MasterSwitchType; org.apache.hadoop.hbase.client.MasterSwitchType;
org.apache.hadoop.hbase.client.TableState;
org.apache.hadoop.hbase.master.assignment.AssignmentManager; org.apache.hadoop.hbase.master.assignment.AssignmentManager;
org.apache.hadoop.hbase.master.DeadServer; org.apache.hadoop.hbase.master.DeadServer;
org.apache.hadoop.hbase.master.HMaster; org.apache.hadoop.hbase.master.HMaster;
@ -464,21 +465,23 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>Namespace</th> <th>Namespace</th>
<th>Table Name</th> <th>Name</th>
<%if (frags != null) %> <%if (frags != null) %>
<th title="Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.">Frag.</th> <th title="Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.">Frag.</th>
</%if> </%if>
<th>Online Regions</th> <th>State</th>
<th>Open Regions</th>
<th>Offline Regions</th> <th>Offline Regions</th>
<th>Failed Regions</th> <th>Failed Regions</th>
<th>Split Regions</th> <th>Split Regions</th>
<th>Other Regions</th> <th>Other (CLOSED, etc.)</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
<%for TableDescriptor desc : tables%> <%for TableDescriptor desc : tables%>
<%java> <%java>
HTableDescriptor htDesc = new HTableDescriptor(desc); HTableDescriptor htDesc = new HTableDescriptor(desc);
TableName tableName = htDesc.getTableName(); TableName tableName = htDesc.getTableName();
TableState tableState = master.getTableStateManager().getTableState(tableName);
Map<RegionState.State, List<RegionInfo>> tableRegions = Map<RegionState.State, List<RegionInfo>> tableRegions =
master.getAssignmentManager().getRegionStates() master.getAssignmentManager().getRegionStates()
.getRegionByStateOfTable(tableName); .getRegionByStateOfTable(tableName);
@ -502,6 +505,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<%if (frags != null) %> <%if (frags != null) %>
<td align="center"><% frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()).intValue() + "%" : "n/a" %></td> <td align="center"><% frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()).intValue() + "%" : "n/a" %></td>
</%if> </%if>
<td><% tableState.getState() %></td>
<td><% openRegionsCount %></td> <td><% openRegionsCount %></td>
<td><% offlineRegionsCount %></td> <td><% offlineRegionsCount %></td>
<td><% failedRegionsCount %></td> <td><% failedRegionsCount %></td>