Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7114AD9AD for ; Mon, 29 Oct 2012 23:04:12 +0000 (UTC) Received: (qmail 64733 invoked by uid 500); 29 Oct 2012 23:04:12 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 64689 invoked by uid 500); 29 Oct 2012 23:04:12 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 64681 invoked by uid 99); 29 Oct 2012 23:04:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2012 23:04:12 +0000 Date: Mon, 29 Oct 2012 23:04:12 +0000 (UTC) From: "Tianying Chang (JIRA)" To: issues@hbase.apache.org Message-ID: <24458144.41534.1351551852249.JavaMail.jiratomcat@arcas> In-Reply-To: <506152063.40163.1351535412663.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (HBASE-7060) region load balancing by table does not handle the case where a table's region count is less than the number of the RS in the cluter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-7060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tianying Chang updated HBASE-7060: ---------------------------------- Description: When the table's region count is less than the count of region servers, the region balance algorithm will not move the region. For example, the cluster has 100 RS, the table has 50 regions sitting on one RS, they will not be moved to any of the other 99 RS. This is because the algorithm did not calculate the under-loaded RS correctly. This is how the algorithm works with the above example: avg-regions-per-RS=0.5 min-RS-per-RS=0 max-RS-per-RS=1 when they calculate the under loaded RS, the code is as below. Since regionCount=0, which is always >=min, so it will always skip, therefore, no underloaded RS are found. Map underloadedServers = new HashMap(); for (Map.Entry> server: serversByLoad.entrySet()) { int regionCount = server.getKey().getLoad(); if (regionCount >= min) { break; } underloadedServers.put(server.getKey().getServerName(), min - regionCount); } Later the function returns since underloaded RS size is 0 if (serverUnerloaded ==0) return regionsToReturn; was: When the table's region count is less than the count of region servers, the region balance algorithm will not move the region. For example, the cluster has 100 RS, the table has 50 regions sitting on one RS, they will not be moved to any of the other 99 RS. This is because the algorithm did not calculate the under-loaded RS correctly. This is how the algorithm works with the above example: avg-regions-per-RS=0.5 min-RS-per-RS=0 max-RS-per-RS=1 when they calculate the under loaded RS, the code is as below. Since regionCount=0, which is always >=min, so it will always skip, therefore, no underloaded RS are found. Map underloadedServers = new HashMap(); for (Map.Entry> server: serversByLoad.entrySet()) { int regionCount = server.getKey().getLoad(); if (regionCount >= min) { break; } underloadedServers.put(server.getKey().getServerName(), min - regionCount); } Later the function returns since underloaded RS size is 0 if (serverUnerloaded ==0) return regionsToReturn; Release Note: @ted > The above would produce unnecessarily high number of underloaded servers, right ? I think it shouldn't. Because when the code reach here, it means this server is an under-loaded RS. Therefore, it is not procuding un-necessary underloaded server. For the special case when min=1, max=1, we want to shed the extra regions to those RS what has regionCount of 0. And the regionToTake for those RS should be 1. > region load balancing by table does not handle the case where a table's region count is less than the number of the RS in the cluter > ------------------------------------------------------------------------------------------------------------------------------------ > > Key: HBASE-7060 > URL: https://issues.apache.org/jira/browse/HBASE-7060 > Project: HBase > Issue Type: Bug > Components: master > Affects Versions: 0.92.0 > Reporter: Tianying Chang > Assignee: Tianying Chang > Attachments: HBASE-7060.patch > > > When the table's region count is less than the count of region servers, the region balance algorithm will not move the region. For example, the cluster has 100 RS, the table has 50 regions sitting on one RS, they will not be moved to any of the other 99 RS. > This is because the algorithm did not calculate the under-loaded RS correctly. This is how the algorithm works with the above example: > avg-regions-per-RS=0.5 > min-RS-per-RS=0 > max-RS-per-RS=1 > when they calculate the under loaded RS, the code is as below. Since regionCount=0, which is always >=min, so it will always skip, therefore, no underloaded RS are found. > Map underloadedServers = new HashMap(); > for (Map.Entry> server: > serversByLoad.entrySet()) { > int regionCount = server.getKey().getLoad(); > if (regionCount >= min) { break; } > underloadedServers.put(server.getKey().getServerName(), min - regionCount); > } > Later the function returns since underloaded RS size is 0 > if (serverUnerloaded ==0) return regionsToReturn; -- 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