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 c615925417..13ff92943c 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 @@ -92,6 +92,11 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner protected final long maxRowSize; protected final long cellsPerHeartbeatCheck; + // used to guard against a changed next indexed key by doing a identity comparison + // when we try to SKIP insteads of SEEKING + // when the identity changes we need to compare the bytes again + private Cell previousIndexedKey = null; + /** * If we close the memstore scanners before sending data to client, the chunk may be reclaimed * by other updates and the data will be corrupt. @@ -173,7 +178,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner // the seek operation. However, we also look the row-column Bloom filter // for multi-row (non-"get") scans because this is not done in // StoreFile.passesBloomFilter(Scan, SortedSet). - this.useRowColBloom = numCol > 1 || (!get && numCol == 1); + this.useRowColBloom = (numCol > 1 || (!get && numCol == 1)) && store.getFamily().getBloomFilterType() == BloomType.ROWCOL; this.maxRowSize = scanInfo.getTableMaxRowSize(); this.scanUsePread = scan.isSmall()? true: scanInfo.isUsePread(); @@ -800,9 +805,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner @VisibleForTesting protected boolean trySkipToNextRow(Cell cell) throws IOException { Cell nextCell = null; - // used to guard against a changed next indexed key by doing a identity comparison - // when the identity changes we need to compare the bytes again - Cell previousIndexedKey = null; do { Cell nextIndexedKey = getNextIndexedKey(); if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY && @@ -826,9 +828,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner @VisibleForTesting protected boolean trySkipToNextColumn(Cell cell) throws IOException { Cell nextCell = null; - // used to guard against a changed next indexed key by doing a identity comparison - // when the identity changes we need to compare the bytes again - Cell previousIndexedKey = null; do { Cell nextIndexedKey = getNextIndexedKey(); if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY && @@ -844,7 +843,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner // We need this check because it may happen that the new scanner that we get // during heap.next() is requiring reseek due of fake KV previously generated for // ROWCOL bloom filter optimization. See HBASE-19863 for more details - if (nextCell != null && matcher.compareKeyForNextColumn(nextCell, cell) < 0) { + if (useRowColBloom && nextCell != null && matcher.compareKeyForNextColumn(nextCell, cell) < 0) { return false; } return true;