binlijin commented on a change in pull request #1279: HBASE-23949 refactor
loadBalancer implements for rsgroup balance by t…
URL: https://github.com/apache/hbase/pull/1279#discussion_r395399054
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
##########
@@ -1639,6 +1637,44 @@ private void roundRobinAssignment(Cluster cluster,
List<RegionInfo> regions,
}
}
+ private Map<ServerName, List<RegionInfo>> toEnsumbleTableLoad(
+ Map<TableName, Map<ServerName, List<RegionInfo>>> LoadOfAllTable) {
+ Map<ServerName, List<RegionInfo>> returnMap = new TreeMap<>();
+ for (Map<ServerName, List<RegionInfo>> serverNameListMap :
LoadOfAllTable.values()) {
+ serverNameListMap.forEach((serverName, regionInfoList) -> {
+ List<RegionInfo> regionInfos =
+ returnMap.computeIfAbsent(serverName, k -> new ArrayList<>());
+ regionInfos.addAll(regionInfoList);
+ });
+ }
+ return returnMap;
+ }
+
+ @Override
+ public abstract List<RegionPlan> balanceTable(TableName tableName,
+ Map<ServerName, List<RegionInfo>> loadOfOneTable);
+
+
+ @Override
+ public List<RegionPlan>
+ balanceCluster(Map<TableName, Map<ServerName, List<RegionInfo>>>
loadOfAllTable) {
+ if (isByTable) {
+ List<RegionPlan> result = new ArrayList<>();
+ loadOfAllTable.forEach((tableName, loadOfOneTable) -> {
+ LOG.debug("Start Generate Balance plan for table: " + tableName);
+ List<RegionPlan> partialPlans = balanceTable(tableName,
loadOfOneTable);
+ if (partialPlans != null) {
+ result.addAll(partialPlans);
+ }
+ });
+ return result;
+ } else {
+ LOG.debug("Start Generate Balance plan for table: " +
HConstants.ENSEMBLE_TABLE_NAME);
Review comment:
There is no Table ENSEMBLE_TABLE_NAME actually, need to change this log?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services