Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The issue is when region replication is on, ConnectionImplementation.locateRegions() returns duplicated entries.
In the test in my patch, the table should have 1 primary region + 2 secondaries, but ConnectionImplementation.locateRegions() returns 9 regions. Every region repeats 3 times (3 = replicas count).
I think this is because the following code calls locateRegion() even for replica regions and then the result triples.
for (RegionInfo regionInfo : regions) { RegionLocations list = locateRegion(tableName, regionInfo.getStartKey(), useCache, true); if (list != null) { for (HRegionLocation loc : list.getRegionLocations()) { if (loc != null) { locations.add(loc); } } }
The fix in my patch is to make it call locateRegion() only for a primary region.