HBASE-5875 Process RIT and Master restart may remove an online server considering it as a dead server (Rajesh)

Submitted by:Rajesh	
Reviewed by:Ram Ted, Stack	


git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1353688 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2012-06-25 18:07:32 +00:00
parent d0ec4af44a
commit f690e086f6
1 changed files with 24 additions and 8 deletions

View File

@ -748,7 +748,8 @@ Server {
boolean rit = this.assignmentManager. boolean rit = this.assignmentManager.
processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.ROOT_REGIONINFO); processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.ROOT_REGIONINFO);
ServerName currentRootServer = null; ServerName currentRootServer = null;
if (!catalogTracker.verifyRootRegionLocation(timeout)) { boolean rootRegionLocation = catalogTracker.verifyRootRegionLocation(timeout);
if (!rit && !rootRegionLocation) {
currentRootServer = this.catalogTracker.getRootLocation(); currentRootServer = this.catalogTracker.getRootLocation();
splitLogAndExpireIfOnline(currentRootServer); splitLogAndExpireIfOnline(currentRootServer);
this.assignmentManager.assignRoot(); this.assignmentManager.assignRoot();
@ -757,7 +758,13 @@ Server {
// This guarantees that the transition assigning -ROOT- has completed // This guarantees that the transition assigning -ROOT- has completed
this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO); this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO);
assigned++; assigned++;
} else { } else if (rit && !rootRegionLocation) {
// Make sure a -ROOT- location is set.
if (!isRootLocation()) return false;
// This guarantees that the transition assigning -ROOT- has completed
this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO);
assigned++;
} else if (rootRegionLocation) {
// Region already assigned. We didn't assign it. Add to in-memory state. // Region already assigned. We didn't assign it. Add to in-memory state.
this.assignmentManager.regionOnline(HRegionInfo.ROOT_REGIONINFO, this.assignmentManager.regionOnline(HRegionInfo.ROOT_REGIONINFO,
this.catalogTracker.getRootLocation()); this.catalogTracker.getRootLocation());
@ -774,7 +781,8 @@ Server {
status.setStatus("Assigning META region"); status.setStatus("Assigning META region");
rit = this.assignmentManager. rit = this.assignmentManager.
processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.FIRST_META_REGIONINFO); processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.FIRST_META_REGIONINFO);
if (!this.catalogTracker.verifyMetaRegionLocation(timeout)) { boolean metaRegionLocation = this.catalogTracker.verifyMetaRegionLocation(timeout);
if (!rit && !metaRegionLocation) {
ServerName currentMetaServer = ServerName currentMetaServer =
this.catalogTracker.getMetaLocationOrReadLocationFromRoot(); this.catalogTracker.getMetaLocationOrReadLocationFromRoot();
if (currentMetaServer != null if (currentMetaServer != null
@ -782,11 +790,11 @@ Server {
splitLogAndExpireIfOnline(currentMetaServer); splitLogAndExpireIfOnline(currentMetaServer);
} }
assignmentManager.assignMeta(); assignmentManager.assignMeta();
enableServerShutdownHandler(); enableSSHandWaitForMeta();
this.catalogTracker.waitForMeta(); assigned++;
// Above check waits for general meta availability but this does not } else if (rit && !metaRegionLocation) {
// guarantee that the transition has completed // Wait until META region added to region server onlineRegions. See HBASE-5875.
this.assignmentManager.waitForAssignment(HRegionInfo.FIRST_META_REGIONINFO); enableSSHandWaitForMeta();
assigned++; assigned++;
} else { } else {
// Region already assigned. We didnt' assign it. Add to in-memory state. // Region already assigned. We didnt' assign it. Add to in-memory state.
@ -800,6 +808,14 @@ Server {
return true; return true;
} }
private void enableSSHandWaitForMeta() throws IOException, InterruptedException {
enableServerShutdownHandler();
this.catalogTracker.waitForMeta();
// Above check waits for general meta availability but this does not
// guarantee that the transition has completed
this.assignmentManager.waitForAssignment(HRegionInfo.FIRST_META_REGIONINFO);
}
/** /**
* @return True if there a root available * @return True if there a root available
* @throws InterruptedException * @throws InterruptedException