HBASE-13777 Table fragmentation display triggers NPE on master status page

This commit is contained in:
Lars George 2015-05-27 10:22:13 +02:00
parent bb0d64b778
commit 91a5090365
1 changed files with 7 additions and 6 deletions

View File

@ -215,7 +215,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<section>
<& BackupMasterStatusTmpl; master = master &>
</section>
</%if>
</%if>
<section>
@ -367,7 +367,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<%def userTables>
<%java>
HTableDescriptor[] tables = null;
HTableDescriptor[] tables = null;
try (Admin admin = master.getConnection().getAdmin()) {
tables = master.isInitialized() ? admin.listTables() : null;
}
@ -389,9 +389,10 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
</tr>
<%for HTableDescriptor htDesc : tables%>
<%java>
TableName tableName = htDesc.getTableName();
Map<RegionState.State, List<HRegionInfo>> tableRegions =
master.getAssignmentManager().getRegionStates()
.getRegionByStateOfTable(htDesc.getTableName());
.getRegionByStateOfTable(tableName);
int openRegionsCount = tableRegions.get(RegionState.State.OPEN).size();
int offlineRegionsCount = tableRegions.get(RegionState.State.OFFLINE).size();
int splitRegionsCount = tableRegions.get(RegionState.State.SPLIT).size();
@ -407,10 +408,10 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
- splitRegionsCount;
</%java>
<tr>
<td><% htDesc.getTableName().getNamespaceAsString() %></td>
<td><a href=table.jsp?name=<% htDesc.getTableName().getNameAsString() %>><% htDesc.getTableName().getQualifierAsString() %></a> </td>
<td><% tableName.getNamespaceAsString() %></td>
<td><a href=table.jsp?name=<% tableName.getNameAsString() %>><% tableName.getQualifierAsString() %></a> </td>
<%if (frags != null) %>
<td align="center"><% frags.get(htDesc.getTableName().getNameAsString()) != null ? frags.get(htDesc.getTableName().getQualifierAsString()).intValue() + "%" : "n/a" %></td>
<td align="center"><% frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()).intValue() + "%" : "n/a" %></td>
</%if>
<td><% openRegionsCount %></td>
<td><% offlineRegionsCount %></td>