[GitHub] [hbase] nyl3532016 commented on a change in pull request #1324: HBASE-23949 refactor loadBalancer implements for rsgroup balance by t…
nyl3532016 commented on a change in pull request #1324: HBASE-23949 refactor loadBalancer implements for rsgroup balance by t… URL: https://github.com/apache/hbase/pull/1324#discussion_r396869888 ## File path: hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java ## @@ -110,50 +108,46 @@ public void setMasterServices(MasterServices masterServices) { this.masterServices = masterServices; } + /** + * Override to balance by RSGroup + * not invoke {@link #balanceTable(TableName, Map)} + */ @Override - public List balanceCluster(TableName tableName, Map> - clusterState) throws HBaseIOException { -return balanceCluster(clusterState); - } - - @Override - public List balanceCluster(Map> clusterState) - throws HBaseIOException { + public List balanceCluster( + Map>> loadOfAllTable) throws IOException { if (!isOnline()) { throw new ConstraintException(RSGroupInfoManager.RSGROUP_TABLE_NAME + " is not online, unable to perform balance"); } - -Map> correctedState = correctAssignments(clusterState); -List regionPlans = new ArrayList<>(); - -List misplacedRegions = correctedState.get(LoadBalancer.BOGUS_SERVER_NAME); -for (RegionInfo regionInfo : misplacedRegions) { - ServerName serverName = findServerForRegion(clusterState, regionInfo); - regionPlans.add(new RegionPlan(regionInfo, serverName, null)); -} +// Calculate correct assignments and a list of RegionPlan for mis-placed regions +Pair>>, List> + correctedStateAndRegionPlans = correctAssignments(loadOfAllTable); +Map>> correctedLoadOfAllTable = +correctedStateAndRegionPlans.getFirst(); +List regionPlans = correctedStateAndRegionPlans.getSecond(); +// Add RegionPlan Review comment: see TestRSGroupBasedLoadBalancer#testBalanceCluster , we add test for rsgroup with bytable 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
[GitHub] [hbase] nyl3532016 commented on a change in pull request #1324: HBASE-23949 refactor loadBalancer implements for rsgroup balance by t…
nyl3532016 commented on a change in pull request #1324: HBASE-23949 refactor loadBalancer implements for rsgroup balance by t… URL: https://github.com/apache/hbase/pull/1324#discussion_r396869231 ## File path: hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java ## @@ -110,50 +108,46 @@ public void setMasterServices(MasterServices masterServices) { this.masterServices = masterServices; } + /** + * Override to balance by RSGroup + * not invoke {@link #balanceTable(TableName, Map)} + */ @Override - public List balanceCluster(TableName tableName, Map> - clusterState) throws HBaseIOException { -return balanceCluster(clusterState); - } - - @Override - public List balanceCluster(Map> clusterState) - throws HBaseIOException { + public List balanceCluster( + Map>> loadOfAllTable) throws IOException { if (!isOnline()) { throw new ConstraintException(RSGroupInfoManager.RSGROUP_TABLE_NAME + " is not online, unable to perform balance"); } - -Map> correctedState = correctAssignments(clusterState); -List regionPlans = new ArrayList<>(); - -List misplacedRegions = correctedState.get(LoadBalancer.BOGUS_SERVER_NAME); -for (RegionInfo regionInfo : misplacedRegions) { - ServerName serverName = findServerForRegion(clusterState, regionInfo); - regionPlans.add(new RegionPlan(regionInfo, serverName, null)); -} +// Calculate correct assignments and a list of RegionPlan for mis-placed regions +Pair>>, List> + correctedStateAndRegionPlans = correctAssignments(loadOfAllTable); +Map>> correctedLoadOfAllTable = +correctedStateAndRegionPlans.getFirst(); +List regionPlans = correctedStateAndRegionPlans.getSecond(); +// Add RegionPlan Review comment: ok, I format it 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