You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/03/08 06:41:35 UTC

[GitHub] [hbase] sunhelly commented on a change in pull request #3024: HBASE-25635 CandidateGenerator may miss some region balance actions

sunhelly commented on a change in pull request #3024:
URL: https://github.com/apache/hbase/pull/3024#discussion_r589199906



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CandidateGenerator.java
##########
@@ -104,14 +106,19 @@ int pickOtherRandomRack(BaseLoadBalancer.Cluster cluster, int rackIndex) {
     if (thisServer < 0 || otherServer < 0) {
       return BaseLoadBalancer.Cluster.NullAction;
     }
-
-    // Decide who is most likely to need another region
-    int thisRegionCount = cluster.getNumRegions(thisServer);
-    int otherRegionCount = cluster.getNumRegions(otherServer);
-
-    // Assign the chance based upon the above
-    double thisChance = (thisRegionCount > otherRegionCount) ? 0 : 0.5;
-    double otherChance = (thisRegionCount <= otherRegionCount) ? 0 : 0.5;
+    double thisChance = 0.5;
+    double otherChance = 0.5;
+    if (getConf() == null || getConf().getBoolean(
+      HBASE_MASTER_BALANCER_RANDOM_PICK_REGIONS_WITH_CONSIDER_COUNT_BALANCE, true)) {

Review comment:
       Yes, I can change the test to make the case pass.
   I added this config because I think the random pick in default candidate with just consider region count may be unexpected. There are cost functions in balancer, which means we can change the cost of the functions to get a balance of region read/write loads, such as ReadRequestCostFunction. When these costs are considered, the region count between regionservers may be not fair like the test case, but we need the count skew to make read/write loads fairly. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org