From 3b8039ed0f687bd9a37303efd9aca63757183a09 Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Fri, 2 Oct 2015 20:23:03 -0700 Subject: [PATCH] HBASE-14539 Slight improvement of StoreScanner.optimize. --- .../hadoop/hbase/regionserver/StoreScanner.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 2cb0b616c37..26fc338f641 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 @@ -676,16 +676,13 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner * (see HBASE-13109) */ private ScanQueryMatcher.MatchCode optimize(ScanQueryMatcher.MatchCode qcode, Cell cell) { - Cell nextIndexedKey = getNextIndexedKey(); - if (nextIndexedKey == null || nextIndexedKey == HConstants.NO_NEXT_INDEXED_KEY || - store == null) { - return qcode; - } switch(qcode) { case INCLUDE_AND_SEEK_NEXT_COL: case SEEK_NEXT_COL: { - if (matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) { + Cell nextIndexedKey = getNextIndexedKey(); + if (nextIndexedKey != null && nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY + && matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) { return qcode == MatchCode.SEEK_NEXT_COL ? MatchCode.SKIP : MatchCode.INCLUDE; } break; @@ -693,7 +690,9 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner case INCLUDE_AND_SEEK_NEXT_ROW: case SEEK_NEXT_ROW: { - if (matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) { + Cell nextIndexedKey = getNextIndexedKey(); + if (nextIndexedKey != null && nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY + && matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) { return qcode == MatchCode.SEEK_NEXT_ROW ? MatchCode.SKIP : MatchCode.INCLUDE; } break;