hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1211695 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/ServerManager.java src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
Date Wed, 07 Dec 2011 22:59:07 GMT
Author: tedyu
Date: Wed Dec  7 22:59:06 2011
New Revision: 1211695

URL: http://svn.apache.org/viewvc?rev=1211695&view=rev
Log:
HBASE-4610  Port HBASE-3380 (Master failover can split logs of live servers) to 92/trunk

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1211695&r1=1211694&r2=1211695&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Dec  7 22:59:06 2011
@@ -452,6 +452,7 @@ Release 0.92.0 - Unreleased
    HBASE-4878  Master crash when splitting hlog may cause data loss (Chunhui Shen)
    HBASE-4945  NPE in HRegion.bulkLoadHFiles (Andrew P and Lars H)
    HBASE-4942  HMaster is unable to start of HFile V1 is used (Honghua Zhu)
+   HBASE-4610  Port HBASE-3380 (Master failover can split logs of live servers) to 92/trunk
 
   TESTS
    HBASE-4450  test for number of blocks read: to serve as baseline for expected

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=1211695&r1=1211694&r2=1211695&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java Wed Dec  7
22:59:06 2011
@@ -522,16 +522,34 @@ public class ServerManager {
   public void waitForRegionServers(MonitoredTask status)
   throws InterruptedException {
     long interval = this.master.getConfiguration().
-      getLong("hbase.master.wait.on.regionservers.interval", 3000);
+      getLong("hbase.master.wait.on.regionservers.interval", 1500);
+    long timeout = this.master.getConfiguration().
+    getLong("hbase.master.wait.on.regionservers.timeout", 4500);
+    int minToStart = this.master.getConfiguration().
+    getInt("hbase.master.wait.on.regionservers.mintostart", 1);
+    int maxToStart = this.master.getConfiguration().
+    getInt("hbase.master.wait.on.regionservers.maxtostart", Integer.MAX_VALUE);    
     // So, number of regionservers > 0 and its been n since last check in, break,
     // else just stall here
     int count = 0;
+    long slept = 0;
     for (int oldcount = countOfRegionServers(); !this.master.isStopped();) {
       Thread.sleep(interval);
+      slept += interval;
       count = countOfRegionServers();
       if (count == oldcount && count > 0) break;
 
       String msg;
+      if (count == oldcount && count >= minToStart && slept >= timeout)
{
+        LOG.info("Finished waiting for regionserver count to settle; " +
+            "count=" + count + ", sleptFor=" + slept);
+        break;
+      }
+      if (count >= maxToStart) {
+        LOG.info("At least the max configured number of regionserver(s) have " +
+            "checked in: " + count);
+        break;
+      }
       if (count == 0) {
         msg = "Waiting on regionserver(s) to checkin";
       } else {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java?rev=1211695&r1=1211694&r2=1211695&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java Wed Dec
 7 22:59:06 2011
@@ -69,8 +69,13 @@ public class TestMasterFailover {
     final int NUM_MASTERS = 3;
     final int NUM_RS = 3;
 
+    // Create config to use for this cluster
+    Configuration conf = HBaseConfiguration.create();
+    conf.setInt("hbase.master.wait.on.regionservers.mintostart", 3);
+    conf.setInt("hbase.master.wait.on.regionservers.maxtostart", 3);
+
     // Start the cluster
-    HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+    HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
     TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS);
     MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
 
@@ -298,6 +303,8 @@ public class TestMasterFailover {
     // Need to drop the timeout much lower
     conf.setInt("hbase.master.assignment.timeoutmonitor.period", 2000);
     conf.setInt("hbase.master.assignment.timeoutmonitor.timeout", 4000);
+    conf.setInt("hbase.master.wait.on.regionservers.mintostart", 3);
+    conf.setInt("hbase.master.wait.on.regionservers.maxtostart", 3);
 
     // Start the cluster
     HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
@@ -596,6 +603,8 @@ public class TestMasterFailover {
     // Need to drop the timeout much lower
     conf.setInt("hbase.master.assignment.timeoutmonitor.period", 2000);
     conf.setInt("hbase.master.assignment.timeoutmonitor.timeout", 4000);
+    conf.setInt("hbase.master.wait.on.regionservers.mintostart", 1);
+    conf.setInt("hbase.master.wait.on.regionservers.maxtostart", 2);
 
     // Create and start the cluster
     HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);



Mime
View raw message