[ 
https://issues.apache.org/jira/browse/HBASE-23949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guanghao Zhang resolved HBASE-23949.
------------------------------------
    Fix Version/s: 2.2.5
                   2.4.0
                   2.3.0
                   3.0.0
       Resolution: Fixed

Pushed to branch-2.2+. Thanks [~niuyulin] for contributing.

> refactor  loadBalancer implements for rsgroup balance by table to  achieve 
> overallbalanced
> ------------------------------------------------------------------------------------------
>
>                 Key: HBASE-23949
>                 URL: https://issues.apache.org/jira/browse/HBASE-23949
>             Project: HBase
>          Issue Type: Bug
>          Components: rsgroup
>    Affects Versions: 2.2.0
>            Reporter: niuyulin
>            Assignee: niuyulin
>            Priority: Major
>             Fix For: 3.0.0, 2.3.0, 2.4.0, 2.2.5
>
>
>  now can not achieve overallbalanced when use rsgroup balancer and by table 
> is on,
> because balance every table actually use the clusterload only contain one 
> table's load.
> we should use clusterload contain all this rsgroup table's load to balance 
> overall
>  
>  hbase/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> {code:java}
>   public boolean balance(boolean force) throws IOException {
>     ......
>     boolean isByTable = 
> getConfiguration().getBoolean("hbase.master.loadbalance.bytable", false);
>     Map<TableName, Map<ServerName, List<RegionInfo>>> assignments =
>       this.assignmentManager.getRegionStates()
>         .getAssignmentsForBalancer(tableStateManager, 
> this.serverManager.getOnlineServersList(),
>           isByTable);
>     for (Map<ServerName, List<RegionInfo>> serverMap : assignments.values()) {
>       
> serverMap.keySet().removeAll(this.serverManager.getDrainingServersList());
>     }
> //Give the balancer the current cluster state.
>     this.balancer.setClusterMetrics(getClusterMetricsWithoutCoprocessor());
>     this.balancer.setClusterLoad(assignments);
>     List<RegionPlan> plans = new ArrayList<>();
>     for (Entry<TableName, Map<ServerName, List<RegionInfo>>> e : 
> assignments.entrySet()) {
>       List<RegionPlan> partialPlans = 
> this.balancer.balanceCluster(e.getKey(), e.getValue());
>       if (partialPlans != null) {
>         plans.addAll(partialPlans);
>       }
>     }
> {code}
> now do refactor:
>  # add method 'balanceTable' in interface LoadBalancer
>  # SimpleLoadBalancer and StochasticLoadBalancer do the real 'balanceTable' , 
> and 'balanceTable' is not support in BaseLoadBalancer and 
> RSGroupBasedLoadBalancer
>  # RSGroupBasedLoadBalancer invoke balanceCluster , and pass GroupClusterLoad 
> to internal balacer by group
>  # internal balancer balance cluster invoke 'balanceTable' 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to