HBASE-21590 Optimize trySkipToNextColumn in StoreScanner a bit.
This commit is contained in:
parent
f32d261843
commit
cb1966dc2d
|
@ -802,12 +802,16 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected boolean trySkipToNextRow(Cell cell) throws IOException {
|
protected boolean trySkipToNextRow(Cell cell) throws IOException {
|
||||||
Cell nextCell = null;
|
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 {
|
do {
|
||||||
Cell nextIndexedKey = getNextIndexedKey();
|
Cell nextIndexedKey = getNextIndexedKey();
|
||||||
if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY
|
if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY
|
||||||
&& matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) {
|
&& (nextIndexedKey == previousIndexedKey || matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0)) {
|
||||||
this.heap.next();
|
this.heap.next();
|
||||||
++kvsScanned;
|
++kvsScanned;
|
||||||
|
previousIndexedKey = nextIndexedKey;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -823,12 +827,16 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected boolean trySkipToNextColumn(Cell cell) throws IOException {
|
protected boolean trySkipToNextColumn(Cell cell) throws IOException {
|
||||||
Cell nextCell = null;
|
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 {
|
do {
|
||||||
Cell nextIndexedKey = getNextIndexedKey();
|
Cell nextIndexedKey = getNextIndexedKey();
|
||||||
if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY
|
if (nextIndexedKey != null && nextIndexedKey != KeyValueScanner.NO_NEXT_INDEXED_KEY
|
||||||
&& matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) {
|
&& (nextIndexedKey == previousIndexedKey || matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0)) {
|
||||||
this.heap.next();
|
this.heap.next();
|
||||||
++kvsScanned;
|
++kvsScanned;
|
||||||
|
previousIndexedKey = nextIndexedKey;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue