diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java index fbdf7b2f1..9baf9b8fd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java @@ -776,16 +776,15 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner */ @VisibleForTesting protected boolean trySkipToNextRow(Cell cell) throws IOException { + Cell nextIndexedKey = getNextIndexedKey(); + if (nextIndexedKey == null || nextIndexedKey == KeyValueScanner.NO_NEXT_INDEXED_KEY + || matcher.compareKeyForNextRow(nextIndexedKey, cell) < 0) { + return false; + } Cell nextCell = null; do { - Cell nextIndexedKey = getNextIndexedKey(); - if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY - && matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) { - this.heap.next(); - ++kvsScanned; - } else { - return false; - } + this.heap.next(); + ++kvsScanned; } while ((nextCell = this.heap.peek()) != null && CellUtil.matchingRow(cell, nextCell)); return true; } @@ -797,16 +796,15 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner */ @VisibleForTesting protected boolean trySkipToNextColumn(Cell cell) throws IOException { + Cell nextIndexedKey = getNextIndexedKey(); + if (nextIndexedKey == null || nextIndexedKey == KeyValueScanner.NO_NEXT_INDEXED_KEY + || matcher.compareKeyForNextColumn(nextIndexedKey, cell) < 0) { + return false; + } Cell nextCell = null; do { - Cell nextIndexedKey = getNextIndexedKey(); - if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY - && matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) { - this.heap.next(); - ++kvsScanned; - } else { - return false; - } + this.heap.next(); + ++kvsScanned; } while ((nextCell = this.heap.peek()) != null && CellUtil.matchingRowColumn(cell, nextCell)); return true; }