clarax commented on a change in pull request #3657:
URL: https://github.com/apache/hbase/pull/3657#discussion_r700639097



##########
File path: 
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/PrimaryRegionCountSkewCostFunction.java
##########
@@ -66,8 +66,12 @@ void prepare(BalancerClusterState cluster) {
   @Override
   protected void regionMoved(int region, int oldServer, int newServer) {
     cost.applyCostsChange(costs -> {
-      costs[oldServer] = computeCostForRegionServer(oldServer);
-      costs[newServer] = computeCostForRegionServer(newServer);
+      if (region == cluster.regionIndexToPrimaryIndex[region]) {

Review comment:
       This is to update the cost when a region is moved. The old computation 
recompute the cost on the src and dest server. The change just increment 
primary region count on the new server. If it is moved from another server, the 
count is decremented too for that server. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to