HBASE-9773 Master aborted when hbck asked the master to assign a region that was already online
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1532633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
76b5c4f3cc
commit
c610e59c0d
|
@ -1684,6 +1684,9 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
versionOfClosingNode, dest, transitionInZK)) {
|
versionOfClosingNode, dest, transitionInZK)) {
|
||||||
LOG.debug("Sent CLOSE to " + server + " for region " +
|
LOG.debug("Sent CLOSE to " + server + " for region " +
|
||||||
region.getRegionNameAsString());
|
region.getRegionNameAsString());
|
||||||
|
if (!transitionInZK && state != null) {
|
||||||
|
regionOffline(region);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// This never happens. Currently regionserver close always return true.
|
// This never happens. Currently regionserver close always return true.
|
||||||
|
|
|
@ -112,11 +112,21 @@ public class TestAssignmentManagerOnCluster {
|
||||||
|
|
||||||
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
||||||
master.assignRegion(hri);
|
master.assignRegion(hri);
|
||||||
master.getAssignmentManager().waitForAssignment(hri);
|
AssignmentManager am = master.getAssignmentManager();
|
||||||
|
am.waitForAssignment(hri);
|
||||||
|
|
||||||
ServerName serverName = master.getAssignmentManager().
|
RegionStates regionStates = am.getRegionStates();
|
||||||
getRegionStates().getRegionServerOfRegion(hri);
|
ServerName serverName = regionStates.getRegionServerOfRegion(hri);
|
||||||
TEST_UTIL.assertRegionOnServer(hri, serverName, 200);
|
TEST_UTIL.assertRegionOnServer(hri, serverName, 200);
|
||||||
|
|
||||||
|
// Region is assigned now. Let's assign it again.
|
||||||
|
// Master should not abort, and region should be assigned.
|
||||||
|
RegionState oldState = regionStates.getRegionState(hri);
|
||||||
|
TEST_UTIL.getHBaseAdmin().assign(hri.getRegionName());
|
||||||
|
master.getAssignmentManager().waitForAssignment(hri);
|
||||||
|
RegionState newState = regionStates.getRegionState(hri);
|
||||||
|
assertTrue(newState.isOpened()
|
||||||
|
&& newState.getStamp() != oldState.getStamp());
|
||||||
} finally {
|
} finally {
|
||||||
TEST_UTIL.deleteTable(Bytes.toBytes(table));
|
TEST_UTIL.deleteTable(Bytes.toBytes(table));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue