nyl3532016 commented on a change in pull request #1243: HBASE-23944 The method setClusterLoad of SimpleLoadBalancer is incorr… URL: https://github.com/apache/hbase/pull/1243#discussion_r388766538
########## File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java ########## @@ -171,20 +171,33 @@ public void testBalanceClusterOverall() throws Exception { */ @Test public void testImpactOfBalanceClusterOverall() throws Exception { + testImpactOfBalanceClusterOverall(false); + } + + @Test + public void testImpactOfBalanceClusterOverallWithTableClusterLoad() throws Exception { + testImpactOfBalanceClusterOverall(true); + } + + private void testImpactOfBalanceClusterOverall(boolean useTableClusterLoad) throws Exception { Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoad = new TreeMap<>(); Map<ServerName, List<RegionInfo>> clusterServers = mockUniformClusterServers(mockUniformCluster); List<ServerAndLoad> clusterList = convertToList(clusterServers); clusterLoad.put(TableName.valueOf(name.getMethodName()), clusterServers); // use overall can achieve both table and cluster level balance - HashMap<TableName, TreeMap<ServerName, List<RegionInfo>>> result1 = mockClusterServersWithTables(clusterServers); - loadBalancer.setClusterLoad(clusterLoad); + Map<TableName, Map<ServerName, List<RegionInfo>>> result1 = mockClusterServersWithTables(clusterServers); Review comment: clusterLoad's value is map (server to all region on it , whatever region's table), clusterLoad's key is no use results1's value is map(server to region ,the region only belong to the key table), results1's key is actual tableName in balance by table, we should use results1 ---------------------------------------------------------------- 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