HBASE-12398 Region isn't assigned in an extreme race condition (Jeffrey Zhong)

This commit is contained in:
Enis Soztutar 2014-12-02 19:50:34 -08:00
parent b189b25ab3
commit a25194a3e4
2 changed files with 13 additions and 1 deletions

View File

@ -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(

View File

@ -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.