Repository: phoenix
Updated Branches:
  refs/heads/4.0 6c47f8a2b -> 3d157bcd0


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/3d157bcd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3d157bcd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3d157bcd

Branch: refs/heads/4.0
Commit: 3d157bcd012f5574b778a40eba64ee933246d7a8
Parents: 6c47f8a
Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org>
Authored: Tue Oct 14 17:58:25 2014 +0000
Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org>
Committed: Tue Oct 14 17:58:25 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/3d157bcd/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) {

Reply via email to