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


##########
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:
   Finally, the build results look good.
   
   However, this is very interesting point and something hbase should document 
it well. The idea is to be able to return large rowkeys upto length: (2^15 - 
1), but that does not mean client should be able to store rowkey of this max 
length. The max length of the rowkey should be determined based on:
   
   1. table name bytes
   2. rowkey bytes
   3. length of string "99999999999999" (used by hbase to formulate region name 
during meta lookup)
   4. whether meta lookup uses new format of region encoding (if yes, it will 
add MD5_HEX_LENGTH into calculation)
   
   Concatenation of above params should be of max length (2^15 - 1), not just 
rowkey bytes alone.
   
   This is important to ensure when hbase client performs meta lookup for the 
large rowkey, it is able to keep scan start rowkey length <= (2^15 - 1).



-- 
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: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to