hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r1528563 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
Date Wed, 02 Oct 2013 17:08:33 GMT
Author: jdcryans
Date: Wed Oct  2 17:08:33 2013
New Revision: 1528563

URL: http://svn.apache.org/r1528563
Log:
HBASE-8710 The balancer shouldn't try balancing one node (James Kinley via JD)

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java?rev=1528563&r1=1528562&r2=1528563&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
Wed Oct  2 17:08:33 2013
@@ -54,6 +54,7 @@ import com.google.common.collect.Sets;
  *
  */
 public abstract class BaseLoadBalancer implements LoadBalancer {
+  private static final int MIN_SERVER_BALANCE = 2;
   private volatile boolean stopped = false;
 
   /**
@@ -377,8 +378,11 @@ public abstract class BaseLoadBalancer i
   }
 
   protected boolean needsBalance(ClusterLoadState cs) {
-    if (cs.getNumServers() == 0) {
-      LOG.debug("numServers=0 so skipping load balancing");
+    if (cs.getNumServers() < MIN_SERVER_BALANCE) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Not running balancer because only " + cs.getNumServers()
+            + " active regionserver(s)");
+      }
       return false;
     }
     // Check if we even need to do any load balancing



Mime
View raw message