HBASE-17023 Region left unassigned due to AM and SSH each thinking others would do the assignment work (Stephen Yuan Jiang)
This commit is contained in:
parent
c2801a2ea8
commit
e51584381a
|
@ -864,8 +864,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
case RS_ZK_REGION_CLOSED:
|
||||
case RS_ZK_REGION_FAILED_OPEN:
|
||||
// Region is closed, insert into RIT and handle it
|
||||
regionStates.setLastRegionServerOfRegion(sn, encodedName);
|
||||
regionStates.updateRegionState(regionInfo, State.CLOSED, sn);
|
||||
regionStates.setRegionStateTOCLOSED(regionInfo, sn);
|
||||
if (!replicasToClose.contains(regionInfo)) {
|
||||
invokeAssign(regionInfo);
|
||||
} else {
|
||||
|
|
|
@ -419,6 +419,31 @@ public class RegionStates {
|
|||
return oldState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the region state to CLOSED
|
||||
*/
|
||||
public RegionState setRegionStateTOCLOSED(
|
||||
final HRegionInfo regionInfo,
|
||||
final ServerName serverName) {
|
||||
ServerName sn = serverName;
|
||||
if (sn == null) {
|
||||
RegionState regionState = getRegionState(regionInfo.getEncodedName());
|
||||
if (regionState != null) {
|
||||
sn = regionState.getServerName();
|
||||
}
|
||||
// TODO: if sn is null, should we dig into
|
||||
// lastAssignments.get(regionInfo.getEncodedName() to get the server name?
|
||||
// For now, I just keep the same logic that works in the past
|
||||
}
|
||||
// We have to make sure that the last region server is set to be the same as the
|
||||
// current RS. If we don't do that, we could run into situation that both AM and SSH
|
||||
// think other would do the assignment work; at the end, neither does the work and
|
||||
// region remains RIT.
|
||||
// See HBASE-13330 and HBASE-17023
|
||||
setLastRegionServerOfRegion(sn, regionInfo.getEncodedName());
|
||||
return updateRegionState(regionInfo, State.CLOSED, sn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a region state. It will be put in transition if not already there.
|
||||
*/
|
||||
|
|
|
@ -99,8 +99,7 @@ public class ClosedRegionHandler extends EventHandler implements TotesHRegionInf
|
|||
return;
|
||||
}
|
||||
// ZK Node is in CLOSED state, assign it.
|
||||
assignmentManager.getRegionStates().updateRegionState(
|
||||
regionInfo, RegionState.State.CLOSED);
|
||||
assignmentManager.getRegionStates().setRegionStateTOCLOSED(regionInfo, null);
|
||||
// This below has to do w/ online enable/disable of a table
|
||||
assignmentManager.removeClosedRegion(regionInfo);
|
||||
assignmentManager.invokeAssign(regionInfo, false);
|
||||
|
|
Loading…
Reference in New Issue