HBASE-26327 Replicas cohosted on a rack shouldn't keep triggering balancer (#3788)
Signed-off-by: Huaxiang Sun <huaxiangsun@apache.org>
This commit is contained in:
parent
362117b52c
commit
32eb23c8f3
@ -337,11 +337,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
|
|||||||
if (Math.abs(regionReplicaHostCostFunction.cost()) > CostFunction.COST_EPSILON) {
|
if (Math.abs(regionReplicaHostCostFunction.cost()) > CostFunction.COST_EPSILON) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
regionReplicaRackCostFunction.prepare(c);
|
return (Math.abs(regionReplicaHostCostFunction.cost()) > CostFunction.COST_EPSILON);
|
||||||
if (Math.abs(regionReplicaRackCostFunction.cost()) > CostFunction.COST_EPSILON) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestrictedApi(explanation = "Should only be called in tests", link = "",
|
@RestrictedApi(explanation = "Should only be called in tests", link = "",
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.hadoop.hbase.master.balancer;
|
package org.apache.hadoop.hbase.master.balancer;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -161,8 +162,7 @@ public class TestStochasticLoadBalancerRegionReplica extends BalancerTestBase {
|
|||||||
map.put(s2, regionsOnS2);
|
map.put(s2, regionsOnS2);
|
||||||
// add another server so that the cluster has some host on another rack
|
// add another server so that the cluster has some host on another rack
|
||||||
map.put(ServerName.valueOf("host2", 1000, 11111), randomRegions(1));
|
map.put(ServerName.valueOf("host2", 1000, 11111), randomRegions(1));
|
||||||
assertTrue(
|
assertFalse(loadBalancer.needsBalance(HConstants.ENSEMBLE_TABLE_NAME,
|
||||||
loadBalancer.needsBalance(HConstants.ENSEMBLE_TABLE_NAME,
|
|
||||||
new BalancerClusterState(map, null, null, new ForTestRackManagerOne())));
|
new BalancerClusterState(map, null, null, new ForTestRackManagerOne())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class TestStochasticLoadBalancerRegionReplicaWithRacks extends BalancerTe
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRegionReplicationOnMidClusterWithRacks() {
|
public void testRegionReplicationOnMidClusterWithRacks() {
|
||||||
conf.setLong(StochasticLoadBalancer.MAX_STEPS_KEY, 10000000L);
|
conf.setLong(StochasticLoadBalancer.MAX_STEPS_KEY, 100000000L);
|
||||||
conf.setFloat("hbase.master.balancer.stochastic.maxMovePercent", 1.0f);
|
conf.setFloat("hbase.master.balancer.stochastic.maxMovePercent", 1.0f);
|
||||||
conf.setLong("hbase.master.balancer.stochastic.maxRunningTime", 120 * 1000); // 120 sec
|
conf.setLong("hbase.master.balancer.stochastic.maxRunningTime", 120 * 1000); // 120 sec
|
||||||
loadBalancer.onConfigurationChange(conf);
|
loadBalancer.onConfigurationChange(conf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user