Skip to content

Commit

Permalink
HBASE-23335 : Improving cost functions array copy in StochasticLoadBa…
Browse files Browse the repository at this point in the history
…lancer

Signed-off-by: stack <[email protected]>
  • Loading branch information
virajjasani committed Jan 19, 2020
1 parent dc602d7 commit 64b9d2f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,7 @@ public synchronized List<RegionPlan> balanceCluster(Map<ServerName,

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;
Expand Down Expand Up @@ -462,9 +460,7 @@ public synchronized List<RegionPlan> balanceCluster(Map<ServerName,

// 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
Expand Down

0 comments on commit 64b9d2f

Please sign in to comment.