You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2018/12/13 19:55:40 UTC
hbase git commit: HBASE-21590 Optimize trySkipToNextColumn in
StoreScanner a bit.
Repository: hbase
Updated Branches:
refs/heads/branch-1 81dc223ae -> 4e7fc18fb
HBASE-21590 Optimize trySkipToNextColumn in StoreScanner a bit.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4e7fc18f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4e7fc18f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4e7fc18f
Branch: refs/heads/branch-1
Commit: 4e7fc18fb6946a0e5728c4f6265c840e2d2a1434
Parents: 81dc223
Author: Lars Hofhansl <la...@apache.org>
Authored: Thu Dec 13 11:55:28 2018 -0800
Committer: Lars Hofhansl <la...@apache.org>
Committed: Thu Dec 13 11:55:28 2018 -0800
----------------------------------------------------------------------
.../apache/hadoop/hbase/regionserver/StoreScanner.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e7fc18f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
----------------------------------------------------------------------
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 31856e3..96d5946 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
@@ -796,12 +796,16 @@ 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
- && matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) {
+ && (nextIndexedKey == previousIndexedKey || matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0)) {
this.heap.next();
++kvsScanned;
+ previousIndexedKey = nextIndexedKey;
} else {
return false;
}
@@ -817,12 +821,16 @@ 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
- && matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) {
+ && (nextIndexedKey == previousIndexedKey || matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0)) {
this.heap.next();
++kvsScanned;
+ previousIndexedKey = nextIndexedKey;
} else {
return false;
}