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