hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1202983 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Date Thu, 17 Nov 2011 01:45:04 GMT
Author: nspiegelberg
Date: Thu Nov 17 01:45:03 2011
New Revision: 1202983

URL: http://svn.apache.org/viewvc?rev=1202983&view=rev
Log:
Detect master failover when backup master becomes active

Summary: When the backup master becomes primary, it currently uses the cluster
startup vs. master failover flag that was set in the constructor, potentially a
long time before it becomes primary. This makes the newly active master
re-evaluate that flag.

Test Plan: Run unit tests. Do master failover on a dev cluster and ensure that
the new active master correctly identifies it as a failover and not a cluster
startup.

Reviewers: kranganathan, kannan

Reviewed By: kranganathan

CC: hbase-eng@lists, kranganathan

Differential Revision: 355126

Revert Plan: OK

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1202983&r1=1202982&r2=1202983&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Thu Nov
17 01:45:03 2011
@@ -189,7 +189,7 @@ public class HMaster extends Thread impl
   private Map<String, Integer> fragmentation = null;
   private RegionServerOperationQueue regionServerOperationQueue;
 
-  // True if this is the master that started the cluster.
+  /** True if this is the master that started the cluster. */
   private boolean isClusterStartup;
 
   private long masterStartupTime = Long.MAX_VALUE;
@@ -227,7 +227,7 @@ public class HMaster extends Thread impl
     // before we race to write our address to zookeeper.
     zooKeeperWrapper = ZooKeeperWrapper.createInstance(conf,
         getZKWrapperName());
-    isClusterStartup = (zooKeeperWrapper.scanRSDirectory().size() == 0);
+    detectClusterStartup();
 
     this.numRetries =  conf.getInt("hbase.client.retries.number", 2);
     this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
@@ -305,7 +305,9 @@ public class HMaster extends Thread impl
       return false;
     }
 
+    detectClusterStartup();
     isActiveMaster = true;
+
     this.regionServerOperationQueue =
       new RegionServerOperationQueue(this.conf, this.closed);
 
@@ -345,6 +347,10 @@ public class HMaster extends Thread impl
     return true;
   }
 
+  public void detectClusterStartup() {
+    isClusterStartup = (zooKeeperWrapper.scanRSDirectory().size() == 0);
+  }
+
   public long getApplyPreferredAssignmentPeriod() {
     return this.applyPreferredAssignmentPeriod;
   }
@@ -373,10 +379,6 @@ public class HMaster extends Thread impl
     return isClusterStartup;
   }
 
-  public void resetClusterStartup() {
-    isClusterStartup = false;
-  }
-
   public HServerAddress getHServerAddress() {
     return address;
   }



Mime
View raw message