-
Type:
Bug
-
Status: Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.0.0-alpha-1, 2.3.0, 2.1.8, 2.2.3
-
Component/s: mapreduce
-
Labels:None
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.
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
if (i >= numPartitions-1)
It should be
if (i >= numPartitions){
- links to