usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [2/2] incubator-usergrid git commit: Adds slice duplicate. Otherwise cursor concurrency errors occur.
Date Wed, 08 Jul 2015 21:55:16 GMT
Adds slice duplicate.  Otherwise cursor concurrency errors occur.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/219a425a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/219a425a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/219a425a

Branch: refs/heads/USERGRID-752
Commit: 219a425a656d33af1c9defbb08b6d73d574dadeb
Parents: d872e03
Author: Todd Nine <tnine@apigee.com>
Authored: Wed Jul 8 15:55:12 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Wed Jul 8 15:55:12 2015 -0600

----------------------------------------------------------------------
 .../persistence/cassandra/QueryProcessor.java    |  2 +-
 .../persistence/query/ir/QuerySlice.java         | 19 +++++++++++++++++++
 .../persistence/query/ir/SearchVisitor.java      |  4 ++--
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/219a425a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/QueryProcessor.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/QueryProcessor.java
index 10f4fa5..538f6d6 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/QueryProcessor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/QueryProcessor.java
@@ -220,7 +220,7 @@ public class QueryProcessor {
      * Apply cursor position and sort order to this slice. This should only be invoke at
evaluation time to ensure that
      * the IR tree has already been fully constructed
      */
-    public void applyCursorAndSort( QuerySlice slice ) {
+    public  void applyCursorAndSort( QuerySlice slice ) {
         // apply the sort first, since this can change the hash code
         SortPredicate sort = getSort( slice.getPropertyName() );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/219a425a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/QuerySlice.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/QuerySlice.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/QuerySlice.java
index 77c0a6b..2b7d23c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/QuerySlice.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/QuerySlice.java
@@ -53,6 +53,25 @@ public class QuerySlice {
     }
 
 
+
+    /**
+     * Create a deep copy of the query slice from the original query slice
+     * @param original
+     */
+    private QuerySlice(final QuerySlice original){
+        this.propertyName = original.propertyName;
+        this.nodeId = original.nodeId;
+        this.start = original.start;
+        this.finish = original.finish;
+        this.cursor = original.cursor;
+        this.reversed = original.reversed;
+    }
+
+
+    public QuerySlice duplicate(){
+        return new QuerySlice( this );
+    }
+
     /** Reverse this slice. Flips the reversed switch and correctly changes the start and
finish */
     public void reverse() {
         reversed = !reversed;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/219a425a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/SearchVisitor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/SearchVisitor.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/SearchVisitor.java
index 2fe2e37..8c5fe2b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/SearchVisitor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/SearchVisitor.java
@@ -229,7 +229,7 @@ public abstract class SearchVisitor implements NodeVisitor {
                 scanner = new NoOpIndexScanner();
             }
             else {
-                scanner = secondaryIndexScan( orderByNode, slice );
+                scanner = secondaryIndexScan( orderByNode, slice.duplicate() );
             }
 
             final SliceCursorGenerator sliceCursorGenerator = new SliceCursorGenerator( slice
);
@@ -264,7 +264,7 @@ public abstract class SearchVisitor implements NodeVisitor {
         IntersectionIterator intersections = new IntersectionIterator( queryProcessor.getPageSizeHint(
node ) );
 
         for ( QuerySlice slice : node.getAllSlices() ) {
-            IndexScanner scanner = secondaryIndexScan( node, slice );
+            IndexScanner scanner = secondaryIndexScan( node, slice.duplicate() );
 
             final SliceCursorGenerator sliceCursorGenerator = new SliceCursorGenerator( slice
);
 


Mime
View raw message