junegunn commented on code in PR #8360:
URL: https://github.com/apache/hbase/pull/8360#discussion_r3426858110


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java:
##########
@@ -216,9 +216,14 @@ public ReturnCode filterCell(final Cell c) {
         return ReturnCode.INCLUDE;
       }
     }
-    // NOT FOUND -> seek next using hint
+    // NOT FOUND -> seek next using hint or skip the current row.
     lastFoundIndex = -1;
     filterRow = true;
+    // For reverse scans, a non-matching row can recreate itself as the next 
hint. Since fuzzy
+    // matching is row-key based, skip the whole non-matching row instead of 
seeking to it again.
+    if (isReversed() && tracker.updateTracker(c) && 
tracker.isNextRowSameAs(c)) {
+      return ReturnCode.NEXT_ROW;
+    }
     return ReturnCode.SEEK_NEXT_USING_HINT;

Review Comment:
   Hmm, I have mixed feelings about this. If the `isNextRowSameAs` condition 
doesn't hold during a reverse scan, `updateTracker` will be called again in 
`getNextCellHint`. AFAICT, this duplicate call doesn't affect the correctness.
   
   Since `getNextCellHint` is only called when `filterCell` returns 
`SEEK_NEXT_USING_HINT`, we could unconditionally call `updateTracker` here, and 
avoid it in `getNextCellHint`, but then `getNextCellHint` will no longer be 
self-contained and tightly coupled with a preceding call of `filterCell`, so 
I'm not sure if that's the right direction.
   



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