virajjasani commented on code in PR #1923:
URL: https://github.com/apache/phoenix/pull/1923#discussion_r1664645544


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/PagingRegionScanner.java:
##########
@@ -81,40 +201,70 @@ private boolean next(List<Cell> results, boolean raw) 
throws IOException {
                 scan.withStartRow(adjustedStartRowKey,
                         Bytes.toBoolean(adjustedStartRowKeyIncludeBytes));
                 PackagePrivateFieldAccessor.setMvccReadPoint(scan, 
mvccReadPoint);
+                if (multiKeyPointLookup != null) {
+                    scan.withStopRow(adjustedStartRowKey, true);
+                    // Reset multiKeyPointLookupPosition to start scanning 
from the first row
+                    multiKeyPointLookup.reset();
+                    multiKeyPointLookup.verifyStartRowKey(adjustedStartRowKey);
+                }
                 delegate = region.getScanner(scan);
                 
scan.setAttribute(QueryServices.PHOENIX_PAGING_NEW_SCAN_START_ROWKEY, null);
                 
scan.setAttribute(QueryServices.PHOENIX_PAGING_NEW_SCAN_START_ROWKEY_INCLUDE, 
null);
+            } else {
+                if (multiKeyPointLookup != null) {
+                   RegionScanner regionScanner = 
multiKeyPointLookup.getNewScanner();
+                   if (regionScanner == null) {
+                       return false;
+                   }
+                   delegate = regionScanner;
+                }
             }
             if (pagingFilter != null) {
                 pagingFilter.init();
             }
+
             boolean hasMore = raw ? delegate.nextRaw(results) : 
delegate.next(results);
             if (pagingFilter == null) {
-                return hasMore;
+                return multiKeyPointLookup != null ? 
multiKeyPointLookup.hasMore() : hasMore;
             }
             if (!hasMore) {
-                // There is no more row from the HBase region scanner. We need 
to check if PageFilter
-                // has stopped the region scanner
+                // There is no more row from the HBase region scanner. We need 
to check if
+                // PagingFilter has stopped the region scanner
                 if (pagingFilter.isStopped()) {
                     if (results.isEmpty()) {
                         byte[] rowKey = 
pagingFilter.getCurrentRowKeyToBeExcluded();
                         LOGGER.info("Page filter stopped, generating dummy key 
{} ",
                                 Bytes.toStringBinary(rowKey));
                         ScanUtil.getDummyResult(rowKey, results);
+                        if (multiKeyPointLookup != null) {
+                            multiKeyPointLookup.lastDummyCell = results.get(0);
+                            multiKeyPointLookup.lookupPosition--;
+                        }
+                        return true;

Review Comment:
   I think the problem here is that if we return from here, region can move and 
then it will start off with dummy rowkey which we cannot use for point lookup. 
Each coproc that performs complex or long running scans have handling of this 
logic but simple point lookup or skip scan might not need this handling, so i 
think if we can resume scan here rather than return to client, that could help 
with the problem of region moving immediately after returning dummy rowkey.
   
   Since we know it's point lookup, we can resume the scan here from 
PagingRegionScanner only, because getting dummy for point lookup might only 
happen with tests (due to 0ms timeout) but in real production getting dummy for 
point lookup would be extremely rare event and even if it does, it might be 
better to resume scan here because it's single row only.



-- 
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