hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject svn commit: r1353688 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Date Mon, 25 Jun 2012 18:07:33 GMT
Author: ramkrishna
Date: Mon Jun 25 18:07:32 2012
New Revision: 1353688

URL: http://svn.apache.org/viewvc?rev=1353688&view=rev
Log:
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	

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1353688&r1=1353687&r2=1353688&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon
Jun 25 18:07:32 2012
@@ -748,7 +748,8 @@ 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();
@@ -757,7 +758,13 @@ Server {
       // This guarantees that the transition assigning -ROOT- has completed
       this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO);
       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.
       this.assignmentManager.regionOnline(HRegionInfo.ROOT_REGIONINFO,
         this.catalogTracker.getRootLocation());
@@ -774,7 +781,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
@@ -782,11 +790,11 @@ 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) {
+      // Wait until META region added to region server onlineRegions. See HBASE-5875.
+      enableSSHandWaitForMeta();
       assigned++;
     } else {
       // Region already assigned.  We didnt' assign it.  Add to in-memory state.
@@ -800,6 +808,14 @@ Server {
     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
    * @throws InterruptedException



Mime
View raw message