hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1583769 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master: AssignmentManager.java HMaster.java HMasterCommandLine.java ServerManager.java balancer/BaseLoadBalancer.java
Date Tue, 01 Apr 2014 19:53:56 GMT
Author: jxiang
Date: Tue Apr  1 19:53:55 2014
New Revision: 1583769

URL: http://svn.apache.org/r1583769
Log:
HBASE-10851 Wait for regionservers to join the cluster

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1583769&r1=1583768&r2=1583769&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Tue Apr  1 19:53:55 2014
@@ -64,7 +64,6 @@ import org.apache.hadoop.hbase.executor.
 import org.apache.hadoop.hbase.executor.ExecutorService;
 import org.apache.hadoop.hbase.ipc.RpcClient;
 import org.apache.hadoop.hbase.ipc.RpcClient.FailedServerException;
-import org.apache.hadoop.hbase.ipc.RpcClient.FailedServerException;
 import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
 import org.apache.hadoop.hbase.master.RegionState.State;
 import org.apache.hadoop.hbase.master.balancer.FavoredNodeAssignmentHelper;
@@ -2211,11 +2210,9 @@ public class AssignmentManager extends Z
       }
       LOG.debug("No previous transition plan found (or ignoring " +
         "an existing plan) for " + region.getRegionNameAsString() +
-        "; generated random plan=" + randomPlan + "; " +
-        serverManager.countOfRegionServers() +
-               " (online=" + serverManager.getOnlineServers().size() +
-               ", available=" + destServers.size() + ") available servers" +
-               ", forceNewPlan=" + forceNewPlan);
+        "; generated random plan=" + randomPlan + "; " + destServers.size() +
+        " (online=" + serverManager.getOnlineServers().size() +
+        ") available servers, forceNewPlan=" + forceNewPlan);
         return randomPlan;
       }
     LOG.debug("Using pre-existing plan for " +

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=1583769&r1=1583768&r2=1583769&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 Tue
Apr  1 19:53:55 2014
@@ -532,7 +532,7 @@ public class HMaster extends HRegionServ
     this.initializationBeforeMetaAssignment = true;
 
     // Wait for regionserver to finish initialization.
-    while (!isOnline()) {
+    while (!isStopped() && !isOnline()) {
       synchronized (online) {
         online.wait(100);
       }
@@ -543,6 +543,10 @@ public class HMaster extends HRegionServ
     this.balancer.setMasterServices(this);
     this.balancer.initialize();
 
+    // Check if master is shutting down because of some issue
+    // in initializing the regionserver or the balancer.
+    if(isStopped()) return;
+
     // Make sure meta assigned before proceeding.
     status.setStatus("Assigning Meta Region");
     assignMeta(status, previouslyFailedMetaRSs);

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java?rev=1583769&r1=1583768&r2=1583769&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
Tue Apr  1 19:53:55 2014
@@ -151,6 +151,7 @@ public class HMasterCommandLine extends 
       // and regionserver both in the one JVM.
       if (LocalHBaseCluster.isLocal(conf)) {
         DefaultMetricsSystem.setMiniClusterMode(true);
+        conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
         final MiniZooKeeperCluster zooKeeperCluster = new MiniZooKeeperCluster(conf);
         File zkDataPath = new File(conf.get(HConstants.ZOOKEEPER_DATA_DIR));
         int zkClientPort = conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, 0);

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=1583769&r1=1583768&r2=1583769&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Tue Apr  1 19:53:55 2014
@@ -436,10 +436,19 @@ public class ServerManager {
     return averageLoad;
   }
 
-  /** @return the count of active regionservers */
-  int countOfRegionServers() {
+  /**
+   * Get the count of active regionservers that are not backup
+   * masters. This count may not be accurate depending on timing.
+   * @return the count of active regionservers
+   */
+  private int countOfRegionServers() {
     // Presumes onlineServers is a concurrent map
-    return this.onlineServers.size();
+    int count = this.onlineServers.size();
+    if (balancer != null) {
+      count -= balancer.getExcludedServers().size();
+      if (count < 0) count = 0;
+    }
+    return count;
   }
 
   /**
@@ -849,7 +858,7 @@ public class ServerManager {
     final long timeout = this.master.getConfiguration().
       getLong(WAIT_ON_REGIONSERVERS_TIMEOUT, 4500);
     int minToStart = this.master.getConfiguration().
-      getInt(WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
+      getInt(WAIT_ON_REGIONSERVERS_MINTOSTART, 2);
     if (minToStart < 1) {
       LOG.warn(String.format(
         "The value of '%s' (%d) can not be less than 1, ignoring.",

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java?rev=1583769&r1=1583768&r2=1583769&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
Tue Apr  1 19:53:55 2014
@@ -496,6 +496,10 @@ public abstract class BaseLoadBalancer i
     if (!usingBackupMasters) excludedServers.add(serverName);
   }
 
+  public Set<ServerName> getExcludedServers() {
+    return excludedServers;
+  }
+
   @Override
   public Configuration getConf() {
     return this.config;



Mime
View raw message