HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
dc602d7d5d
commit
64b9d2f5ab
|
@ -414,9 +414,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
|
|||
|
||||
double currentCost = computeCost(cluster, Double.MAX_VALUE);
|
||||
curOverallCost = currentCost;
|
||||
for (int i = 0; i < this.curFunctionCosts.length; i++) {
|
||||
curFunctionCosts[i] = tempFunctionCosts[i];
|
||||
}
|
||||
System.arraycopy(tempFunctionCosts, 0, curFunctionCosts, 0, this.curFunctionCosts.length);
|
||||
|
||||
double initCost = currentCost;
|
||||
double newCost = currentCost;
|
||||
|
@ -462,9 +460,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
|
|||
|
||||
// save for JMX
|
||||
curOverallCost = currentCost;
|
||||
for (int i = 0; i < this.curFunctionCosts.length; i++) {
|
||||
curFunctionCosts[i] = tempFunctionCosts[i];
|
||||
}
|
||||
System.arraycopy(tempFunctionCosts, 0, curFunctionCosts, 0, this.curFunctionCosts.length);
|
||||
} else {
|
||||
// Put things back the way they were before.
|
||||
// TODO: undo by remembering old values
|
||||
|
|
Loading…
Reference in New Issue