HBASE-4899 Region would be assigned twice easily with continually killing server and moving region in testing environment

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1209367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-12-02 05:55:25 +00:00
parent 31468fa7ac
commit 5a0f0313b9
1 changed files with 16 additions and 1 deletions

View File

@ -286,7 +286,22 @@ public class ServerShutdownHandler extends EventHandler {
if (processDeadRegion(e.getKey(), e.getValue(),
this.services.getAssignmentManager(),
this.server.getCatalogTracker())) {
this.services.getAssignmentManager().assign(e.getKey(), true);
RegionState rit = this.services.getAssignmentManager().isRegionInTransition(e.getKey());
ServerName addressFromAM = this.services.getAssignmentManager()
.getRegionServerOfRegion(e.getKey());
if (rit != null && !rit.isClosing() && !rit.isPendingClose()) {
// Skip regions that were in transition unless CLOSING or
// PENDING_CLOSE
LOG.info("Skip assigning region " + rit.toString());
} else if (addressFromAM != null
&& !addressFromAM.equals(this.serverName)) {
LOG.debug("Skip assigning region "
+ e.getKey().getRegionNameAsString()
+ " because it has been opened in "
+ addressFromAM.getServerName());
} else {
this.services.getAssignmentManager().assign(e.getKey(), true);
}
}
}
}