[
https://issues.apache.org/jira/browse/HBASE-22265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Kyle Purtell resolved HBASE-22265.
-----------------------------------------
Resolution: Not A Bug
> Cost calculation in SLB may not be correct
> ------------------------------------------
>
> Key: HBASE-22265
> URL: https://issues.apache.org/jira/browse/HBASE-22265
> Project: HBase
> Issue Type: Brainstorming
> Components: Balancer
> Reporter: Biju Nair
> Priority: Minor
>
> In
> [CostFromArray|https://github.com/apache/hbase/blob/baf3ae80f5588ee848176adefc9f56818458a387/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java#L1039]
> method of SLB, the calculated value of {{max}} which in turn used to scale
> "may" not be correct.
> {noformat}
> // Compute max as if all region servers had 0 and one had the sum of all
> costs. This must be
> // a zero sum cost for this to make sense.
> double max = ((count - 1) * mean) + (total - mean);{noformat}
> with the current calculation {{max}} will end up with the value close to
> twice that of the total of all the elements passed in the array (less the
> mean value) while the comment above the calculation seem to imply that the
> {{max}} value to be sum of all costs i.e. the value of the variable
> {{total}}.
>
> Also it would be good to document the reasoning for the following calculation
> in the same method. I can create a patch if anyone who is familiar with this
> code can help understand the reasoning.
> {noformat}
> min = (numHigh * (Math.ceil(mean) - mean)) + (numLow * (mean -
> Math.floor(mean)));{noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)