[
https://issues.apache.org/jira/browse/HBASE-12760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259855#comment-14259855
]
cuijianwei commented on HBASE-12760:
------------------------------------
I agree that moving the region to the second highest locality server might help
because the cost of other cost functions might decrease after the action:). On
the other hand, we have a group of candidate action generators. Each generator
seems to decrease the total cost from a specific aspect. For
LocalityBasedCandidateGenerator, I think the goal should be to achieve higher
locality for all regions. If we allow LocalityBasedCandidateGenerator to move
region to server with lower locality, LocalityBasedCandidateGenerator will look
like RandomCandidateGenerator? If so, we can increase the weight of
RandomCandidateGenerator to achieve similar result.
> 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
> Attachments: HBASE-12760-trunk.patch
>
>
> 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)