HBASE-18193 Master web UI presents the incorrect number of regions

This commit is contained in:
Chia-Ping Tsai 2017-06-08 16:16:56 +08:00
parent 61839d7143
commit 30817b922e
2 changed files with 22 additions and 1 deletions

View File

@ -686,7 +686,9 @@ public class RegionStates {
} }
for (RegionStateNode node: regionsMap.values()) { for (RegionStateNode node: regionsMap.values()) {
tableRegions.get(node.getState()).add(node.getRegionInfo()); if (node.getTable().equals(tableName)) {
tableRegions.get(node.getState()).add(node.getRegionInfo());
}
} }
return tableRegions; return tableRegions;
} }

View File

@ -416,6 +416,25 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase {
} }
} }
@Test
public void testGetRegionByStateOfTable() throws Exception {
final TableName tableName = TableName.valueOf("testGetRegionByStateOfTable");
try {
HRegionInfo hri = createTableAndGetOneRegion(tableName);
RegionStates regionStates =
TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
assertTrue(regionStates.getRegionByStateOfTable(tableName)
.get(RegionState.State.OPEN)
.contains(hri));
assertFalse(regionStates.getRegionByStateOfTable(TableName.valueOf("I_am_the_phantom"))
.get(RegionState.State.OPEN)
.contains(hri));
} finally {
TEST_UTIL.deleteTable(tableName);
}
}
@Test @Test
public void testMoveRegion() throws Exception { public void testMoveRegion() throws Exception {
final TableName tableName = TableName.valueOf("testMoveRegion"); final TableName tableName = TableName.valueOf("testMoveRegion");