Repository: phoenix Updated Branches: refs/heads/4.0 6e89ee5dc -> 2d0aeacff
PHOENIX-1251 Salted queries with range scan become full table scans Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2d0aeacf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2d0aeacf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2d0aeacf Branch: refs/heads/4.0 Commit: 2d0aeacff5b38805df85f7be5731eb608abc3f4c Parents: 6e89ee5 Author: James Taylor <[email protected]> Authored: Fri Oct 3 21:53:19 2014 -0700 Committer: James Taylor <[email protected]> Committed: Fri Oct 3 21:53:19 2014 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/phoenix/compile/ScanRanges.java | 6 ++++++ .../main/java/org/apache/phoenix/filter/SkipScanFilter.java | 3 +++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d0aeacf/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java index 1bd8cef..4591bdb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java @@ -210,6 +210,9 @@ public class ScanRanges { public Scan intersectScan(Scan scan, final byte[] originalStartKey, final byte[] originalStopKey, final int keyOffset) { byte[] startKey = originalStartKey; byte[] stopKey = originalStopKey; + if (stopKey.length > 0 && Bytes.compareTo(startKey, stopKey) >= 0) { + return null; + } boolean mayHaveRows = false; // Keep the keys as they are if we have a point lookup, as we've already resolved the // salt bytes in that case. @@ -338,6 +341,9 @@ public class ScanRanges { scanStopKey = prefixKey(scanStopKey, scanKeyOffset, prefixBytes, keyOffset); } } + if (scanStopKey.length > 0 && Bytes.compareTo(scanStartKey, scanStopKey) >= 0) { + return null; + } newScan.setStartRow(scanStartKey); newScan.setStopRow(scanStopKey); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d0aeacf/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java index b964871..9e1f55a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java @@ -149,6 +149,9 @@ public class SkipScanFilter extends FilterBase implements Writable { // we should either have no previous hint, or the next hint should always come after the previous hint // TODO: put this assert back after trying failing tests without it + // Tests failing with this assert include: + // DeleteIT.testDeleteAllFromTableWithIndexNoAutoCommitNoSalting() + // MutableIndexIT.testCoveredColumnUpdatesWithLocalIndex() // assert previousCellHint == null || KeyValue.COMPARATOR.compare(nextCellHint, previousCellHint) > 0 // : "next hint must come after previous hint (prev=" + previousCellHint + ", next=" + nextCellHint + ", kv=" + kv + ")"; }
