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 2015/04/15 13:57:59 UTC

[jira] [Commented] (HBASE-12759) numMaxRegionsPerTable is not updated correctly in BaseLoadBalancer.regionMoved

    [ https://issues.apache.org/jira/browse/HBASE-12759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14496093#comment-14496093 ] 

cuijianwei commented on HBASE-12759:
------------------------------------

We used this patch in our production, it seems ok, ping [~eclark]:)

> numMaxRegionsPerTable is not updated correctly in BaseLoadBalancer.regionMoved
> ------------------------------------------------------------------------------
>
>                 Key: HBASE-12759
>                 URL: https://issues.apache.org/jira/browse/HBASE-12759
>             Project: HBase
>          Issue Type: Bug
>          Components: Balancer
>    Affects Versions: 1.0.0
>            Reporter: cuijianwei
>            Priority: Minor
>         Attachments: HBASE-12759-trunk.patch
>
>
> numMaxRegionsPerTable will be updated in BaseLoadBalancer.regionMoved(...) as:
> {code}
>     void regionMoved(int region, int oldServer, int newServer) {
>       ....
>       int tableIndex = regionIndexToTableIndex[region];
>       if (oldServer >= 0) {
>         numRegionsPerServerPerTable[oldServer][tableIndex]--;
>       }
>       numRegionsPerServerPerTable[newServer][tableIndex]++;
>       //check whether this caused maxRegionsPerTable in the new Server to be updated
>       if (numRegionsPerServerPerTable[newServer][tableIndex] > numMaxRegionsPerTable[tableIndex]) {
>         numRegionsPerServerPerTable[newServer][tableIndex] = numMaxRegionsPerTable[tableIndex];  // ==> should be: numMaxRegionsPerTable[tableIndex] = numRegionsPerServerPerTable[newServer][tableIndex];
>       } else if (oldServer >= 0 && (numRegionsPerServerPerTable[oldServer][tableIndex] + 1)
>           == numMaxRegionsPerTable[tableIndex]) {
>         //recompute maxRegionsPerTable since the previous value was coming from the old server
>         // ===> should reset numMaxRegionsPerTable[tableIndex] before recompute : numMaxRegionsPerTable[tableIndex] = 0;
>         for (int serverIndex = 0 ; serverIndex < numRegionsPerServerPerTable.length; serverIndex++) {
>           if (numRegionsPerServerPerTable[serverIndex][tableIndex] > numMaxRegionsPerTable[tableIndex]) {
>             numMaxRegionsPerTable[tableIndex] = numRegionsPerServerPerTable[serverIndex][tableIndex];
>           }
>         }
>       }
> {code}
> It seems that numMaxRegionsPerTable is not updated correctly as shown above.



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