huaxiangsun commented on a change in pull request #2003:
URL: https://github.com/apache/hbase/pull/2003#discussion_r454031932



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
##########
@@ -174,6 +174,46 @@ public void reloadCachedMappings(List<String> arg0) {
     }
   }
 
+  // This mock allows us to test the LocalityCostFunction
+  public class MockCluster extends BaseLoadBalancer.Cluster {
+
+    private int[][] localities = null;   // [region][server] = percent of 
blocks
+    private boolean firstRegionAsReplica;
+
+    public MockCluster(int[][] regions) {
+      this(regions, false);
+    }
+
+    public MockCluster(int[][] regions, final boolean firstRegionAsReplica) {

Review comment:
       Yeah, this is just simply moved from the TestStochasticLoadBalancer.java 
(if I am not wrong), cause it is needed for the new test case 
TestStochasticLoadBalancerRegionReplica.




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


Reply via email to