wchevreuil commented on a change in pull request #677: HBASE-23073 Add an optional costFunction to balance regions according to a capacity rule URL: https://github.com/apache/hbase/pull/677#discussion_r330993967
########## File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java ########## @@ -366,20 +366,31 @@ protected void updateLoad(final Map<ServerName, ServerAndLoad> map, } protected TreeMap<ServerName, List<RegionInfo>> mockClusterServers(int[] mockCluster) { - return mockClusterServers(mockCluster, -1); + return mockClusterServers(mockCluster, -1, false); + } + + protected TreeMap<ServerName, List<RegionInfo>> mockClusterServers(int[] mockCluster, int numTables) { + return mockClusterServers(mockCluster, -1, false); } protected BaseLoadBalancer.Cluster mockCluster(int[] mockCluster) { return new BaseLoadBalancer.Cluster( mockClusterServers(mockCluster, -1), null, null, null); } - protected TreeMap<ServerName, List<RegionInfo>> mockClusterServers(int[] mockCluster, int numTables) { + protected TreeMap<ServerName, List<RegionInfo>> mockClusterServers(int[] mockCluster, int numTables, boolean predictibleHosts) { int numServers = mockCluster.length; TreeMap<ServerName, List<RegionInfo>> servers = new TreeMap<>(); for (int i = 0; i < numServers; i++) { int numRegions = mockCluster[i]; - ServerAndLoad sal = randomServer(0); + + ServerAndLoad sal; + if (predictibleHosts) { + sal = randomServer(0, "rs" + i); Review comment: My understanding is that this is the main motivation for having all these _overridings_ here in **BalancerTestBase**. However, this seems very specific for the conditions tested in **TestStochasticLoadBalancerHeterogeneousCost**, so why not leave **BalancerTestBase** untouched, and only override _randomServer(final int numRegionsPerServer)_ on **TestStochasticLoadBalancerHeterogeneousCost** instead? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services