tkhurana commented on code in PR #1848:
URL: https://github.com/apache/phoenix/pull/1848#discussion_r1516942676


##########
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java:
##########
@@ -1005,6 +1005,43 @@ private ScansWithRegionLocations getParallelScans(byte[] 
startKey, byte[] stopKe
         
         int regionIndex = 0;
         int startRegionIndex = 0;
+
+        List<HRegionLocation> regionLocations;
+        if (isSalted && !isLocalIndex) {
+            // key prefix = salt num + view index id + tenant id
+            // If salting is used with tenant or view index id, scan start and 
end
+            // rowkeys will not be empty. We need to generate region locations 
for
+            // all the scan range such that we cover (each salt bucket num) + 
(prefix starting from
+            // index position 1 to cover view index and/or tenant id and/or 
remaining prefix).
+            if (scan.getStartRow().length > 0 && scan.getStopRow().length > 0) 
{
+                regionLocations = new ArrayList<>();
+                for (int i = 0; i < getTable().getBucketNum(); i++) {
+                    byte[] saltStartRegionKey = new 
byte[scan.getStartRow().length];
+                    saltStartRegionKey[0] = (byte) i;
+                    System.arraycopy(scan.getStartRow(), 1, 
saltStartRegionKey, 1,
+                        scan.getStartRow().length - 1);
+
+                    byte[] saltStopRegionKey = new 
byte[scan.getStopRow().length];
+                    saltStopRegionKey[0] = (byte) i;
+                    System.arraycopy(scan.getStopRow(), 1, saltStopRegionKey, 
1,
+                        scan.getStopRow().length - 1);
+
+                    regionLocations.addAll(
+                        getRegionBoundaries(scanGrouper, saltStartRegionKey, 
saltStopRegionKey));
+                }

Review Comment:
   Is all this necessary ? The variable `traverseAllRegions`  is set to true 
for salted tables so what are we gaining with this extra work 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to