[ https://issues.apache.org/jira/browse/HBASE-22980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969802#comment-16969802 ]
Hudson commented on HBASE-22980: -------------------------------- Results for branch branch-2.1 [build #1703 on builds.a.o|https://builds.apache.org/job/HBase%20Nightly/job/branch-2.1/1703/]: (x) *{color:red}-1 overall{color}* ---- details (if available): (/) {color:green}+1 general checks{color} -- For more information [see general report|https://builds.apache.org/job/HBase%20Nightly/job/branch-2.1/1703//General_Nightly_Build_Report/] (/) {color:green}+1 jdk8 hadoop2 checks{color} -- For more information [see jdk8 (hadoop2) report|https://builds.apache.org/job/HBase%20Nightly/job/branch-2.1/1703//JDK8_Nightly_Build_Report_(Hadoop2)/] (x) {color:red}-1 jdk8 hadoop3 checks{color} -- For more information [see jdk8 (hadoop3) report|https://builds.apache.org/job/HBase%20Nightly/job/branch-2.1/1703//JDK8_Nightly_Build_Report_(Hadoop3)/] (/) {color:green}+1 source release artifact{color} -- See build output for details. (/) {color:green}+1 client integration test{color} > 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 > Fix For: 3.0.0, 2.3.0, 2.1.8, 2.2.3 > > > *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)