You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2012/06/25 20:09:35 UTC
svn commit: r1353690 -
/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Author: ramkrishna
Date: Mon Jun 25 18:09:34 2012
New Revision: 1353690
URL: http://svn.apache.org/viewvc?rev=1353690&view=rev
Log:
HBASE-5875 Process RIT and Master restart may remove an online server considering it as a dead server
Submitted by:Rajesh
Reviewed by:Ram, Ted, Stack
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1353690&r1=1353689&r2=1353690&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon Jun 25 18:09:34 2012
@@ -625,18 +625,20 @@ Server {
boolean rit = this.assignmentManager.
processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.ROOT_REGIONINFO);
ServerName currentRootServer = null;
- if (!catalogTracker.verifyRootRegionLocation(timeout)) {
+ boolean rootRegionLocation = catalogTracker.verifyRootRegionLocation(timeout);
+ if (!rit && !rootRegionLocation) {
currentRootServer = this.catalogTracker.getRootLocation();
splitLogAndExpireIfOnline(currentRootServer);
this.assignmentManager.assignRoot();
- this.catalogTracker.waitForRoot();
- //This guarantees that the transition has completed
- this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO);
+ waitForRootAssignment();
+ assigned++;
+ } else if (rit && !rootRegionLocation) {
+ waitForRootAssignment();
assigned++;
} else {
- // 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.catalogTracker.getRootLocation());
+ this.catalogTracker.getRootLocation());
}
// Enable the ROOT table if on process fail over the RS containing ROOT
// was active.
@@ -648,7 +650,8 @@ Server {
status.setStatus("Assigning META region");
rit = this.assignmentManager.
processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.FIRST_META_REGIONINFO);
- if (!this.catalogTracker.verifyMetaRegionLocation(timeout)) {
+ boolean metaRegionLocation = this.catalogTracker.verifyMetaRegionLocation(timeout);
+ if (!rit && !metaRegionLocation) {
ServerName currentMetaServer =
this.catalogTracker.getMetaLocationOrReadLocationFromRoot();
if (currentMetaServer != null
@@ -656,11 +659,10 @@ Server {
splitLogAndExpireIfOnline(currentMetaServer);
}
assignmentManager.assignMeta();
- 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);
+ enableSSHandWaitForMeta();
+ assigned++;
+ } else if (rit && !metaRegionLocation) {
+ enableSSHandWaitForMeta();
assigned++;
} else {
// Region already assigned. We didnt' assign it. Add to in-memory state.
@@ -674,6 +676,22 @@ Server {
return assigned;
}
+ 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);
+ }
+
+ private void waitForRootAssignment() throws InterruptedException {
+ this.catalogTracker.waitForRoot();
+ // This guarantees that the transition has completed
+ this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO);
+ }
+
private void enableCatalogTables(String catalogTableName) {
if (!this.assignmentManager.getZKTable().isEnabledTable(catalogTableName)) {
this.assignmentManager.setEnabledTable(catalogTableName);