HBASE-27389 Add cost function in balancer to consider the cost of building bucket cache before moving regions

This commit is contained in:
Rahul Agarkar 2023-03-31 11:05:04 +05:30
parent 1a7d728b3c
commit 160f484352
2 changed files with 3 additions and 4 deletions

View File

@ -70,7 +70,7 @@ public class PrefetchCacheCostFunction extends CostFunction {
@Override
protected double cost() {
return 1 - prefetchRatio;
return scale(0, 1, (1 - prefetchRatio));
}
@Override

View File

@ -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