HBASE-8710 The balancer shouldn't try balancing one node (James Kinley via JD)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1528564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2013-10-02 17:08:47 +00:00
parent 18d9251a77
commit 3d0c0cb394
1 changed files with 6 additions and 2 deletions

View File

@ -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 implements LoadBalancer {
}
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