You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Guangxu Cheng (Jira)" <ji...@apache.org> on 2019/11/07 02:18:02 UTC

[jira] [Commented] (HBASE-22980) HRegionPartioner getPartition() method incorrectly partitions the regions of the table.

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

Guangxu Cheng commented on HBASE-22980:
---------------------------------------

Pushed to branch-2.1+. Thank [~shardulsingh] for contributing.

> HRegionPartioner getPartition() method incorrectly partitions the regions of the table.
> ---------------------------------------------------------------------------------------
>
>                 Key: HBASE-22980
>                 URL: https://issues.apache.org/jira/browse/HBASE-22980
>             Project: HBase
>          Issue Type: Bug
>          Components: mapreduce
>            Reporter: Shardul Singh
>            Assignee: Shardul Singh
>            Priority: Major
>
> *Problem:*
> Partitioner class HRegionPartitioner in a HBase MapReduce job has a method getPartition(). In getPartition(), there is a scenario where we have check for less number of reducers than region. This scenario seems incorrect because for a rowKey present in last region(let us say nth region) , getPartition() should return value (n-1). But it is not returning n-1 for the last region as it is falling in the case where number of reducers < number of regions and returning some random value. 
> So if a client uses this class as a partitioner class in HBase MapReduce jobs, this method incorrectly partitions the regions because rowKeys present in the last regions does not fall to the last region.
> [https://github.com/apache/hbase/blob/fbd5b5e32753104f88600b0f4c803ab5659bce64/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HRegionPartitioner.java#L92]
> Consider the following scenario:
> if there are 5 regions for the table, partitions = 5 and number of reducers is also 5.
> So in this case above check for reducers < regions should not return true.
> But for the last region when i=4(last region, 5th region) , getPartition should return 4 but it returns 2 because it falls in the case of when we have less reduces than region and returns true for the above condition even though we have reducers = regions. So the condition is incorrect.
>  
> *Solution:*
> Instead of
>       {code} if (i >= numPartitions-1) {code} 
> It should be
>        {code} if (i >= numPartitions){  {code}



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