You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Mallikarjun (Jira)" <ji...@apache.org> on 2020/08/23 09:09:00 UTC

[jira] [Updated] (HBASE-24931) Candidate Generator helper Action method ignoring 0th index region

     [ https://issues.apache.org/jira/browse/HBASE-24931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mallikarjun updated HBASE-24931:
--------------------------------
    Description: 
Balance Candidate generators such as `LocalityBasedCandidateGenerator`, `RegionReplicaCandidateGenerator`,  `RegionReplicaRackCandidateGenerator`, etc uses helper method `getAction` to generate action is ignoring 0th index of `fromRegion` and `toRegion`. 
{code:java}
protected BaseLoadBalancer.Cluster.Action getAction(int fromServer, int fromRegion,
    int toServer, int toRegion) {
  if (fromServer < 0 || toServer < 0) {
    return BaseLoadBalancer.Cluster.NullAction;
  }
  if (fromRegion > 0 && toRegion > 0) {
    return new BaseLoadBalancer.Cluster.SwapRegionsAction(fromServer, fromRegion,
      toServer, toRegion);
  } else if (fromRegion > 0) {
    return new BaseLoadBalancer.Cluster.MoveRegionAction(fromRegion, fromServer, toServer);
  } else if (toRegion > 0) {
    return new BaseLoadBalancer.Cluster.MoveRegionAction(toRegion, toServer, fromServer);
  } else {
    return BaseLoadBalancer.Cluster.NullAction;
  }
}
{code}
Is this unintentional or is there some particular reason? 

  was:
Balance Candidate generators such as `LocalityBasedCandidateGenerator`, `RegionReplicaCandidateGenerator`,  `RegionReplicaRackCandidateGenerator`, etc uses helper method `getAction` to generate action is ignoring 0th index of `fromRegion` and `toRegion`. 
{code:java}
protected BaseLoadBalancer.Cluster.Action getAction(int fromServer, int fromRegion,
    int toServer, int toRegion) {
  if (fromServer < 0 || toServer < 0) {
    return BaseLoadBalancer.Cluster.NullAction;
  }
  if (fromRegion > 0 && toRegion > 0) {
    return new BaseLoadBalancer.Cluster.SwapRegionsAction(fromServer, fromRegion,
      toServer, toRegion);
  } else if (fromRegion > 0) {
    return new BaseLoadBalancer.Cluster.MoveRegionAction(fromRegion, fromServer, toServer);
  } else if (toRegion > 0) {
    return new BaseLoadBalancer.Cluster.MoveRegionAction(toRegion, toServer, fromServer);
  } else {
    return BaseLoadBalancer.Cluster.NullAction;
  }
}
{code}
 

Is this unintentional or is there some particular reason? 

 


> Candidate Generator helper Action method ignoring 0th index region
> ------------------------------------------------------------------
>
>                 Key: HBASE-24931
>                 URL: https://issues.apache.org/jira/browse/HBASE-24931
>             Project: HBase
>          Issue Type: Bug
>          Components: Balancer
>            Reporter: Mallikarjun
>            Assignee: Mallikarjun
>            Priority: Minor
>
> Balance Candidate generators such as `LocalityBasedCandidateGenerator`, `RegionReplicaCandidateGenerator`,  `RegionReplicaRackCandidateGenerator`, etc uses helper method `getAction` to generate action is ignoring 0th index of `fromRegion` and `toRegion`. 
> {code:java}
> protected BaseLoadBalancer.Cluster.Action getAction(int fromServer, int fromRegion,
>     int toServer, int toRegion) {
>   if (fromServer < 0 || toServer < 0) {
>     return BaseLoadBalancer.Cluster.NullAction;
>   }
>   if (fromRegion > 0 && toRegion > 0) {
>     return new BaseLoadBalancer.Cluster.SwapRegionsAction(fromServer, fromRegion,
>       toServer, toRegion);
>   } else if (fromRegion > 0) {
>     return new BaseLoadBalancer.Cluster.MoveRegionAction(fromRegion, fromServer, toServer);
>   } else if (toRegion > 0) {
>     return new BaseLoadBalancer.Cluster.MoveRegionAction(toRegion, toServer, fromServer);
>   } else {
>     return BaseLoadBalancer.Cluster.NullAction;
>   }
> }
> {code}
> Is this unintentional or is there some particular reason? 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)