You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/01/19 01:46:06 UTC
[hbase] branch branch-1 updated: HBASE-23335 : Improving cost
functions array copy in StochasticLoadBalancer
This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new 64b9d2f HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer
64b9d2f is described below
commit 64b9d2f5ab4db65ec494c1f26661e7e2bd0b8664
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Sat Jan 18 17:43:46 2020 -0800
HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer
Signed-off-by: stack <st...@apache.org>
---
.../hadoop/hbase/master/balancer/StochasticLoadBalancer.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
index b14ab40..60c8b67 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
@@ -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