HBASE-27389 Add cost function in balancer to consider the cost of building bucket cache before moving regions
This commit is contained in:
parent
1a7d728b3c
commit
160f484352
|
@ -70,7 +70,7 @@ public class PrefetchCacheCostFunction extends CostFunction {
|
|||
|
||||
@Override
|
||||
protected double cost() {
|
||||
return 1 - prefetchRatio;
|
||||
return scale(0, 1, (1 - prefetchRatio));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -185,7 +185,7 @@ public class TestPrefetchCacheCostBalancer extends StochasticBalancerTestBase {
|
|||
admin.balance();
|
||||
TEST_UTIL.waitUntilNoRegionsInTransition(120000);
|
||||
|
||||
Map<ServerName, ServerMetrics> ssmap = admin.getClusterMetrics().getLiveServerMetrics();
|
||||
Map<ServerName, ServerMetrics> ssmap = cluster.getClusterMetrics().getLiveServerMetrics();
|
||||
assertEquals(REGION_SERVERS, ssmap.size());
|
||||
|
||||
// Get the name of the region server to shutdown and restart
|
||||
|
@ -273,8 +273,7 @@ public class TestPrefetchCacheCostBalancer extends StochasticBalancerTestBase {
|
|||
admin.balance();
|
||||
TEST_UTIL.waitUntilNoRegionsInTransition(120000);
|
||||
|
||||
Map<ServerName, ServerMetrics> ssmap = admin.getClusterMetrics().getLiveServerMetrics();
|
||||
|
||||
Map<ServerName, ServerMetrics> ssmap = cluster.getClusterMetrics().getLiveServerMetrics();
|
||||
assertEquals(REGION_SERVERS, ssmap.size());
|
||||
|
||||
// Shutdown the last server. This is because the server id for an inactive server is reassigned
|
||||
|
|
Loading…
Reference in New Issue