HBASE-16816 HMaster.move() should throw exception if region to move is not online (Allan Yang)

This commit is contained in:
tedyu 2016-10-13 11:11:11 -07:00
parent ca581874b9
commit 57d3e9e756
2 changed files with 7 additions and 0 deletions

View File

@ -1501,6 +1501,11 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
getRegionState(Bytes.toString(encodedRegionName));
if (regionState == null) {
throw new UnknownRegionException(Bytes.toStringBinary(encodedRegionName));
} else if (!assignmentManager.getRegionStates()
.isRegionOnline(regionState.getRegion())) {
throw new HBaseIOException(
"moving region not onlined: " + regionState.getRegion() + ", "
+ regionState);
}
HRegionInfo hri = regionState.getRegion();

View File

@ -157,6 +157,8 @@ public class TestWarmupRegion {
HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(serverid);
byte [] destName = Bytes.toBytes(rs.getServerName().toString());
TEST_UTIL.getMiniHBaseCluster().getMaster().move(info.getEncodedNameAsBytes(), destName);
//wait region online
TEST_UTIL.waitUntilNoRegionsInTransition(1000);
serverid = (serverid + 1) % 2;
}
}