HBASE-6587 Region would be assigned twice in the case of all RS offline (Chunhui)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1373829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-08-16 13:39:53 +00:00
parent c3d1bb07f8
commit 4d512d9019
1 changed files with 12 additions and 4 deletions

View File

@ -2811,11 +2811,19 @@ public class AssignmentManager extends ZooKeeperListener {
// no lock concurrent access ok: we will be working on a copy, and it's java-valid to do
// a copy while another thread is adding/removing items
for (RegionState regionState : regionStates.getRegionsInTransition().values()) {
if (regionState.getStamp() + timeout <= now ||
(this.allRegionServersOffline && !noRSAvailable)) {
//decide on action upon timeout or, if some RSs just came back online, we can start the
// the assignment
if (regionState.getStamp() + timeout <= now) {
// decide on action upon timeout
actOnTimeOut(regionState);
} else if (this.allRegionServersOffline && !noRSAvailable) {
RegionPlan existingPlan = regionPlans.get(regionState.getRegion()
.getEncodedName());
if (existingPlan == null
|| !this.serverManager.isServerOnline(existingPlan
.getDestination())) {
// if some RSs just came back online, we can start the assignment
// right away
actOnTimeOut(regionState);
}
}
}
setAllRegionServersOffline(noRSAvailable);