You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2019/12/02 05:43:25 UTC

[hbase] branch branch-2 updated: HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer (#874)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 399fc8d  HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer (#874)
399fc8d is described below

commit 399fc8d098b2ebd3c3bada24cdf2349beb8c773c
Author: Viraj Jasani <vi...@gmail.com>
AuthorDate: Mon Dec 2 11:12:27 2019 +0530

    HBASE-23335 : Improving cost functions array copy in StochasticLoadBalancer (#874)
---
 .../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 8ab6e6c..dd43127 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
@@ -416,9 +416,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, 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, curFunctionCosts.length);
       } else {
         // Put things back the way they were before.
         // TODO: undo by remembering old values