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


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/UncoveredIndexRegionScanner.java:
##########
@@ -404,4 +421,37 @@ public boolean next(List<Cell> result) throws IOException {
             region.closeRegionOperation();
         }
     }
+
+    /**
+     * Add dummy cell to the result list based on either the previous rowkey 
returned to the
+     * client or the start rowkey and start rowkey include params.
+     *
+     * @param result result to add the dummy cell to.
+     * @param initStartRowKey scan start rowkey.
+     * @param includeInitStartRowKey scan start rowkey included.
+     * @param scan scan object.
+     */
+    private void updateDummyWithPrevRowKey(List<Cell> result, byte[] 
initStartRowKey,
+                                           boolean includeInitStartRowKey, 
Scan scan) {
+        result.clear();
+        if (previousResultRowKey != null) {
+            getDummyResult(previousResultRowKey, result);
+        } else {
+            if (includeInitStartRowKey && initStartRowKey.length > 0) {
+                byte[] prevKey;
+                if (Bytes.compareTo(initStartRowKey, initStartRowKey.length - 
1,
+                        1, Bytes.toBytesBinary("\\x00"), 0, 1) == 0) {
+                    prevKey = new byte[initStartRowKey.length - 1];
+                    System.arraycopy(initStartRowKey, 0, prevKey, 0, 
prevKey.length);
+                } else {
+                    prevKey = 
ByteUtil.previousKeyWithLength(ByteUtil.concat(initStartRowKey,
+                            new byte[10]), initStartRowKey.length + 10);

Review Comment:
   Addressing this with max row length logic turned out to be much complicated 
that what i thought earlier. Very few tests are able to cover the scenario 
where hbase client has to lookup the given row in meta after meta cache expires 
at the client, and when they do, meta lookup fails because meta lookup scan 
start rowkey becomes much larger by combining table name, the dummy rowkey (max 
length - 1) and some constant values added by client.
   
   i have addressed this in the latest commit: 
https://github.com/apache/phoenix/pull/1736/commits/fcbec0f676b08ce757036d33cf4687b797e2c781
   
   awaiting the build result before moving forward.



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