HBASE-12398 Region isn't assigned in an extreme race condition (Jeffrey Zhong)
This commit is contained in:
parent
b189b25ab3
commit
a25194a3e4
|
@ -1073,7 +1073,8 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
return;
|
||||
}
|
||||
// Handle OPENED by removing from transition and deleted zk node
|
||||
regionState = regionStates.updateRegionState(rt, State.OPEN);
|
||||
regionState =
|
||||
regionStates.transitionOpenFromPendingOpenOrOpeningOnServer(rt,regionState, sn);
|
||||
if (regionState != null) {
|
||||
failedOpenTracker.remove(encodedName); // reset the count, if any
|
||||
new OpenedRegionHandler(
|
||||
|
|
|
@ -385,6 +385,17 @@ public class RegionStates {
|
|||
return updateRegionState(regionInfo, state,
|
||||
transition.getServerName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Transition a region state to OPEN from OPENING/PENDING_OPEN
|
||||
*/
|
||||
public synchronized RegionState transitionOpenFromPendingOpenOrOpeningOnServer(
|
||||
final RegionTransition transition, final RegionState fromState, final ServerName sn) {
|
||||
if(fromState.isPendingOpenOrOpeningOnServer(sn)){
|
||||
return updateRegionState(transition, State.OPEN);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a region state. It will be put in transition if not already there.
|
||||
|
|
Loading…
Reference in New Issue