You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "cuijianwei (JIRA)" <ji...@apache.org> on 2014/12/27 12:52:13 UTC

[jira] [Created] (HBASE-12760) Return NullAction when region is located in highest locality server

cuijianwei created HBASE-12760:
----------------------------------

             Summary: Return NullAction when region is located in highest locality server
                 Key: HBASE-12760
                 URL: https://issues.apache.org/jira/browse/HBASE-12760
             Project: HBase
          Issue Type: Improvement
          Components: Balancer
    Affects Versions: 0.99.2
            Reporter: cuijianwei
            Priority: Minor


StochasticLoadBalancer#LocalityBasedCandidateGenerator will try to move a region to the server with the highest locality. The target server is selected by LocalityBasedCandidateGenerator.pickHighestLocalityServer, as:
{code}
    private int pickHighestLocalityServer(Cluster cluster, int thisServer, int thisRegion) {
      ...
      for (int loc : regionLocations) {
        if (loc >= 0 && loc != thisServer) { // find the first suitable server
          return loc;
        }
      }
      ...
    }
{code}
If the region is just located in the best server, the current logic will choose the server having the second highest locality, generating an action to try to move region to server with lower locality. Is it better to return a NullAction in this situation (as below)? so that there won't be further computing caused by the generated action.
{code}
    private int pickHighestLocalityServer(Cluster cluster, int thisServer, int thisRegion) {
      ...
      for (int loc : regionLocations) {
        if (loc == thisServer) {
          return -1; // return NullAction when the region is just located in the best server
        }
        if (loc >= 0) { // find the first suitable server
          return loc;
        }
      }
      ...
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)