[
https://issues.apache.org/jira/browse/HBASE-20133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16393160#comment-16393160
]
Xiang Li commented on HBASE-20133:
----------------------------------
By the way, in TestRSGroupBasedLoadBalancer#assertClusterAsBalanced(),
{code}
if (maxRegions - minRegions < 2) {
// less than 2 between max and min, can't balance
return;
}
int min = numRegions / numServers;
int max = numRegions % numServers == 0 ? min : min + 1;
for (ServerAndLoad server : groupLoad) {
assertTrue(server.getLoad() <= max);
assertTrue(server.getLoad() >= min);
}
{code}
Do you think the code after return is unnecessary? For a group of number, when
its max value - it min value = 0 or 1, every number must fall into the range of
floor(avg) and ceiling(avg), right? So the calculation of floor(avg) and
ceiling(avg) as well as the assertions, seems unnecessary?
> Calculate correct assignment and build region movement plans for mis-placed
> regions in one pass
> -----------------------------------------------------------------------------------------------
>
> Key: HBASE-20133
> URL: https://issues.apache.org/jira/browse/HBASE-20133
> Project: HBase
> Issue Type: Improvement
> Components: rsgroup
> Reporter: Xiang Li
> Assignee: Xiang Li
> Priority: Minor
> Attachments: HBASE-20133.master.000.patch,
> HBASE-20133.master.001.patch, HBASE-20133.master.002.patch
>
>
> In RSGroupBasedLoadBalancer#balanceCluster(clusterState), the logic could be
> improved:
> correctAssignment() builds a map for mis-placed and placed regions. For
> mis-placed regions, the key(ServerName) is BOGUS_SERVER_NAME. Then the logic
> gets those mis-paced regions out and calls findServerForRegion() several
> times to find out the current host server, in order to build RegionPlan for
> movement.
> Some logic in correctAssignment() and findServerForRegion() could be merged
> so as to build both corrected assignment and RegionPlan for mis-placed region
> in one pass. As a result, findServerForRegion() could be removed if I get it
> correctly.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)