Repository: phoenix Updated Branches: refs/heads/master 8f2a76d60 -> 34bfc63c9
PHOENIX-1314 Assertion tripped for skip scan with two unit tests(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/34bfc63c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/34bfc63c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/34bfc63c Branch: refs/heads/master Commit: 34bfc63c9d805985864e1a02e0cae12290e212b2 Parents: 8f2a76d Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Authored: Tue Oct 14 17:35:26 2014 +0000 Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Committed: Tue Oct 14 17:35:26 2014 +0000 ---------------------------------------------------------------------- .../org/apache/phoenix/filter/SkipScanFilter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/34bfc63c/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 33a323e..27af824 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 @@ -21,7 +21,9 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HConstants; @@ -75,7 +77,8 @@ public class SkipScanFilter extends FilterBase implements Writable { private int endKeyLength; private boolean isDone; private int offset; - private Cell nextCellHint; + private Map<ImmutableBytesWritable, Cell> nextCellHintMap = + new HashMap<ImmutableBytesWritable, Cell>(); private final ImmutableBytesWritable ptr = new ImmutableBytesWritable(); @@ -134,8 +137,8 @@ public class SkipScanFilter extends FilterBase implements Writable { } private void setNextCellHint(Cell kv) { - Cell previousCellHint = nextCellHint; - + ImmutableBytesWritable family = new ImmutableBytesWritable(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength()); + Cell nextCellHint = null; if (offset == 0) { nextCellHint = new KeyValue(startKey, 0, startKeyLength, null, 0, 0, null, 0, 0, HConstants.LATEST_TIMESTAMP, Type.Maximum, null, 0, 0); @@ -146,19 +149,16 @@ public class SkipScanFilter extends FilterBase implements Writable { nextCellHint = new KeyValue(nextKey, 0, nextKey.length, null, 0, 0, null, 0, 0, HConstants.LATEST_TIMESTAMP, Type.Maximum, null, 0, 0); } - + Cell previousCellHint = nextCellHintMap.put(family, nextCellHint); // 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 + ")"; } @Override public Cell getNextCellHint(Cell kv) { - return isDone ? null : nextCellHint; + return isDone ? null : nextCellHintMap.get(new ImmutableBytesWritable(kv.getFamilyArray(), + kv.getFamilyOffset(), kv.getFamilyLength())); } public boolean hasIntersect(byte[] lowerInclusiveKey, byte[] upperExclusiveKey) {