HBASE-9555 Reset loadbalancer back to StochasticLoadBalancer
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1523914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3d55d10714
commit
161832243a
|
@ -1057,9 +1057,13 @@ possible configurations would overwhelm and obscure the important.
|
||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>hbase.master.loadbalancer.class</name>
|
<name>hbase.master.loadbalancer.class</name>
|
||||||
<value>org.apache.hadoop.hbase.master.balancer.DefaultLoadBalancer</value>
|
<value>org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer</value>
|
||||||
<description>
|
<description>
|
||||||
Class used to execute the regions balancing when the period occurs.
|
Class used to execute the regions balancing when the period occurs.
|
||||||
|
See the class comment for more on how it works
|
||||||
|
http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.html
|
||||||
|
It replaces the DefaultLoadBalancer as the default (since renamed
|
||||||
|
as the SimpleLoadBalancer).
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -54,8 +54,8 @@ import com.google.common.collect.MinMaxPriorityQueue;
|
||||||
* <p>This classes produces plans for the {@link AssignmentManager} to execute.
|
* <p>This classes produces plans for the {@link AssignmentManager} to execute.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class DefaultLoadBalancer extends BaseLoadBalancer {
|
public class SimpleLoadBalancer extends BaseLoadBalancer {
|
||||||
private static final Log LOG = LogFactory.getLog(DefaultLoadBalancer.class);
|
private static final Log LOG = LogFactory.getLog(SimpleLoadBalancer.class);
|
||||||
private static final Random RANDOM = new Random(System.currentTimeMillis());
|
private static final Random RANDOM = new Random(System.currentTimeMillis());
|
||||||
|
|
||||||
private RegionInfoComparator riComparator = new RegionInfoComparator();
|
private RegionInfoComparator riComparator = new RegionInfoComparator();
|
|
@ -45,7 +45,7 @@ import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
import org.apache.hadoop.hbase.master.HMaster;
|
import org.apache.hadoop.hbase.master.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.LoadBalancer;
|
import org.apache.hadoop.hbase.master.LoadBalancer;
|
||||||
import org.apache.hadoop.hbase.master.balancer.DefaultLoadBalancer;
|
import org.apache.hadoop.hbase.master.balancer.SimpleLoadBalancer;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.util.Threads;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.hbase.zookeeper.EmptyWatcher;
|
import org.apache.hadoop.hbase.zookeeper.EmptyWatcher;
|
||||||
|
@ -556,7 +556,7 @@ public class TestZooKeeper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MockLoadBalancer extends DefaultLoadBalancer {
|
static class MockLoadBalancer extends SimpleLoadBalancer {
|
||||||
static boolean retainAssignCalled = false;
|
static boolean retainAssignCalled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.apache.hadoop.hbase.executor.ExecutorType;
|
||||||
import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
|
import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
|
||||||
import org.apache.hadoop.hbase.master.RegionState.State;
|
import org.apache.hadoop.hbase.master.RegionState.State;
|
||||||
import org.apache.hadoop.hbase.master.TableLockManager.NullTableLockManager;
|
import org.apache.hadoop.hbase.master.TableLockManager.NullTableLockManager;
|
||||||
import org.apache.hadoop.hbase.master.balancer.DefaultLoadBalancer;
|
import org.apache.hadoop.hbase.master.balancer.SimpleLoadBalancer;
|
||||||
import org.apache.hadoop.hbase.master.balancer.LoadBalancerFactory;
|
import org.apache.hadoop.hbase.master.balancer.LoadBalancerFactory;
|
||||||
import org.apache.hadoop.hbase.master.handler.EnableTableHandler;
|
import org.apache.hadoop.hbase.master.handler.EnableTableHandler;
|
||||||
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
|
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
|
||||||
|
@ -797,7 +797,7 @@ public class TestAssignmentManager {
|
||||||
Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
|
Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
|
||||||
} finally {
|
} finally {
|
||||||
this.server.getConfiguration().setClass(
|
this.server.getConfiguration().setClass(
|
||||||
HConstants.HBASE_MASTER_LOADBALANCER_CLASS, DefaultLoadBalancer.class,
|
HConstants.HBASE_MASTER_LOADBALANCER_CLASS, SimpleLoadBalancer.class,
|
||||||
LoadBalancer.class);
|
LoadBalancer.class);
|
||||||
am.getExecutorService().shutdown();
|
am.getExecutorService().shutdown();
|
||||||
am.shutdown();
|
am.shutdown();
|
||||||
|
@ -808,7 +808,7 @@ public class TestAssignmentManager {
|
||||||
* Mocked load balancer class used in the testcase to make sure that the testcase waits until
|
* Mocked load balancer class used in the testcase to make sure that the testcase waits until
|
||||||
* random assignment is called and the gate variable is set to true.
|
* random assignment is called and the gate variable is set to true.
|
||||||
*/
|
*/
|
||||||
public static class MockedLoadBalancer extends DefaultLoadBalancer {
|
public static class MockedLoadBalancer extends SimpleLoadBalancer {
|
||||||
private AtomicBoolean gate;
|
private AtomicBoolean gate;
|
||||||
|
|
||||||
public void setGateVariable(AtomicBoolean gate) {
|
public void setGateVariable(AtomicBoolean gate) {
|
||||||
|
@ -899,7 +899,7 @@ public class TestAssignmentManager {
|
||||||
am.getZKTable().isDisabledTable(REGIONINFO.getTable()));
|
am.getZKTable().isDisabledTable(REGIONINFO.getTable()));
|
||||||
} finally {
|
} finally {
|
||||||
this.server.getConfiguration().setClass(
|
this.server.getConfiguration().setClass(
|
||||||
HConstants.HBASE_MASTER_LOADBALANCER_CLASS, DefaultLoadBalancer.class,
|
HConstants.HBASE_MASTER_LOADBALANCER_CLASS, SimpleLoadBalancer.class,
|
||||||
LoadBalancer.class);
|
LoadBalancer.class);
|
||||||
am.getZKTable().setEnabledTable(REGIONINFO.getTable());
|
am.getZKTable().setEnabledTable(REGIONINFO.getTable());
|
||||||
am.shutdown();
|
am.shutdown();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TestDefaultLoadBalancer extends BalancerTestBase {
|
||||||
public static void beforeAllTests() throws Exception {
|
public static void beforeAllTests() throws Exception {
|
||||||
Configuration conf = HBaseConfiguration.create();
|
Configuration conf = HBaseConfiguration.create();
|
||||||
conf.set("hbase.regions.slop", "0");
|
conf.set("hbase.regions.slop", "0");
|
||||||
loadBalancer = new DefaultLoadBalancer();
|
loadBalancer = new SimpleLoadBalancer();
|
||||||
loadBalancer.setConf(conf);
|
loadBalancer.setConf(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue