You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Sergey Shelukhin (JIRA)" <ji...@apache.org> on 2012/11/07 03:48:12 UTC

[jira] [Commented] (HBASE-7061) region balance algorithm should do "contiue" instead of "break" when calculating the underloaded server

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

Sergey Shelukhin commented on HBASE-7061:
-----------------------------------------

I think the intent is that serversByLoad entries are sorted in ascending order by load (it's a TreeMap and ServerAndLoad first compares load), therefore it adds entries until it finds the first server over the boundary. So it should be correct... Do you see specific problem because of this code?
                
> region balance algorithm should do "contiue" instead of "break" when calculating the underloaded server
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-7061
>                 URL: https://issues.apache.org/jira/browse/HBASE-7061
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Tianying Chang
>            Assignee: Tianying Chang
>
> I found this issue when investigating HBASE-7060. Basically, I think  the intention of this code below is to find all the underloaded server. By using break, it will exit earlier, depending on where the non-overloaded server show up in the list.  "break" should be changed to "continue". 
> Map<ServerName, Integer> underloadedServers = new HashMap<ServerName, Integer>();
> for (Map.Entry<ServerAndLoad, List<HRegionInfo>> server:
> serversByLoad.entrySet()) {
> int regionCount = server.getKey().getLoad();
> if (regionCount >= min) { break; }
> underloadedServers.put(server.getKey().getServerName(), min - regionCount);
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira