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


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java:
##########
@@ -787,10 +787,23 @@ public boolean next(List<? super ExtendedCell> outResult, 
ScannerContext scanner
           case SEEK_NEXT_USING_HINT:
             ExtendedCell nextKV = matcher.getNextKeyHint(cell);
             if (nextKV != null) {
-              int difference = comparator.compare(nextKV, cell);
+              // HBASE-28902: InnerStoreCellComparator only compares family 
lengths,
+              // which breaks when the hint targets a different column family.
+              // If the hint has a non-empty family, use compareFamilies (a 
final
+              // method that does proper byte comparison) first. If it differs 
and
+              // sorts ahead, close this store scanner since it has no data 
for the
+              // hint family. Hints with empty family (e.g. from 
MultiRowRangeFilter)
+              // are row-only seek hints and use the normal comparator path.
+              int familyCmp =
+                nextKV.getFamilyLength() > 0 ? 
comparator.compareFamilies(nextKV, cell) : 0;
+              int difference = familyCmp != 0 ? familyCmp : 
comparator.compare(nextKV, cell);
               if (
                 ((!scan.isReversed() && difference > 0) || (scan.isReversed() 
&& difference < 0))
               ) {
+                if (familyCmp != 0) {
+                  close(false);
+                  return 
scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+                }

Review Comment:
   Good call. That was an oversight. Addressed in 
c8f345870eeaf2001f9a723e0c39fff598b59630.



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java:
##########
@@ -787,10 +787,23 @@ public boolean next(List<? super ExtendedCell> outResult, 
ScannerContext scanner
           case SEEK_NEXT_USING_HINT:
             ExtendedCell nextKV = matcher.getNextKeyHint(cell);
             if (nextKV != null) {
-              int difference = comparator.compare(nextKV, cell);
+              // HBASE-28902: InnerStoreCellComparator only compares family 
lengths,
+              // which breaks when the hint targets a different column family.
+              // If the hint has a non-empty family, use compareFamilies (a 
final
+              // method that does proper byte comparison) first. If it differs 
and
+              // sorts ahead, close this store scanner since it has no data 
for the
+              // hint family. Hints with empty family (e.g. from 
MultiRowRangeFilter)
+              // are row-only seek hints and use the normal comparator path.
+              int familyCmp =
+                nextKV.getFamilyLength() > 0 ? 
comparator.compareFamilies(nextKV, cell) : 0;

Review Comment:
   Also addressed in c8f345870eeaf2001f9a723e0c39fff598b59630.



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