You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/30 16:20:43 UTC

[07/34] git commit: Changed page size to create issue. Need to update test to work with page size of 1k to create the problem

Changed page size to create issue.  Need to update test to work with page size of 1k to create the problem


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

Branch: refs/pull/39/head
Commit: 16455b87386f7d2aefb7e70cef5140ea3cf160fb
Parents: ba1f456
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Jan 22 10:48:42 2014 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Jan 28 18:35:37 2014 -0700

----------------------------------------------------------------------
 .../persistence/cassandra/QueryProcessor.java     |  3 ++-
 .../query/ir/result/IntersectionIterator.java     |  4 +++-
 .../query/ir/result/SliceIterator.java            |  3 +++
 .../query/IntersectionUnionPagingIT.java          | 18 ++++++++++--------
 .../query/ir/result/IntersectionIteratorTest.java |  6 ++++--
 stack/core/src/test/resources/log4j.properties    |  2 +-
 6 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/main/java/org/usergrid/persistence/cassandra/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/QueryProcessor.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/QueryProcessor.java
index b5d77a3..4389b79 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/QueryProcessor.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/QueryProcessor.java
@@ -77,7 +77,8 @@ import static org.usergrid.persistence.Schema.getDefaultSchema;
 
 public class QueryProcessor {
 
-    private static final int PAGE_SIZE = 1000;
+    private static final int PAGE_SIZE = 10;
+//    private static final int PAGE_SIZE = 1000;
     private static final Logger logger = LoggerFactory.getLogger( QueryProcessor.class );
 
     private static final Schema SCHEMA = getDefaultSchema();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/IntersectionIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/IntersectionIterator.java b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/IntersectionIterator.java
index 4ffad1b..5948cb9 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/IntersectionIterator.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/IntersectionIterator.java
@@ -141,7 +141,9 @@ public class IntersectionIterator extends MultiIterator {
 
             final Set<ScanColumn> childResults = child.next();
 
-            results.addAll( Sets.intersection( current, childResults ) );
+            final Set<ScanColumn> intersection =  Sets.intersection( current, childResults );
+
+            results.addAll( intersection );
         }
 
         return results;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/SliceIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/SliceIterator.java b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/SliceIterator.java
index 855a844..6922b9f 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/SliceIterator.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/SliceIterator.java
@@ -142,6 +142,9 @@ public class SliceIterator implements ResultIterator {
                 continue;
             }
 
+
+            logger.debug( "Parsed column with uuid '{}'", parsed.getUUID() );
+
             last = parsed;
             cols.put( parsed.getUUID(), parsed );
             parsedCols.add( parsed );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/test/java/org/usergrid/persistence/query/IntersectionUnionPagingIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/persistence/query/IntersectionUnionPagingIT.java b/stack/core/src/test/java/org/usergrid/persistence/query/IntersectionUnionPagingIT.java
index 5f554d3..76995b9 100644
--- a/stack/core/src/test/java/org/usergrid/persistence/query/IntersectionUnionPagingIT.java
+++ b/stack/core/src/test/java/org/usergrid/persistence/query/IntersectionUnionPagingIT.java
@@ -25,6 +25,7 @@ import java.util.Set;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.usergrid.persistence.Entity;
 import org.usergrid.persistence.Query;
 import org.usergrid.persistence.Results;
 
@@ -43,7 +44,7 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT {
             "select * where (field1Or > '00000000' OR field2Or > '00000000') AND fieldDate = '0000-00-00'";
     private static final String scanUnion =
             "select * where fieldDate = '0000-00-00' AND (field1Or > '00000000' OR field2Or > '00000000') ";
-    private static final int PAGE_SIZE = 100;
+    private static final int PAGE_SIZE = 20;
 
 
     @Test
@@ -55,7 +56,7 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT {
         Set<String> created = performSetup( collectionIoHelper );
 
 
-        testUnionPaging( collectionIoHelper, unionScan, created );
+//        testUnionPaging( collectionIoHelper, unionScan, created );
         testUnionPaging( collectionIoHelper, scanUnion, created );
     }
 
@@ -76,7 +77,7 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT {
     private Set<String> performSetup( final IoHelper io ) throws Exception {
         io.doSetup();
 
-        int size = 500;
+        int size = 40;
 
         long start = System.currentTimeMillis();
 
@@ -92,17 +93,16 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT {
             entity.put( "name", name );
             entity.put( "fieldDate", "0000-00-00" );
 
-            String field1;
+            String field1 = String.format( "%08d", i + 1 );
             String field2;
 
             //use a value slightly smaller than page size, since we want to simulate
             //the cursor issues with union queries
-            if ( i < PAGE_SIZE - 10 ) {
-                field1 = String.format( "%08d", i + 1 );
+
+            if ( i < size - 10 ) {
                 field2 = zeros;
             }
             else {
-                field1 = zeros;
                 field2 = String.format( "%08d", i + 1 );
             }
 
@@ -111,7 +111,9 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT {
             entity.put( "field1Or", field1 );
             entity.put( "field2Or", field2 );
 
-            io.writeEntity( entity );
+            Entity saved =  io.writeEntity( entity );
+
+            LOG.info("Writing entity with id '{}'", saved.getUuid());
         }
 
         long stop = System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java b/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
index c165caa..9ad4623 100644
--- a/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
+++ b/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
@@ -49,11 +49,13 @@ public class IntersectionIteratorTest {
 
         // we should get intersection on 1, 3, and 8
         InOrderIterator first = new InOrderIterator( 100 );
+        first.add( id9 );
+        first.add( id8 );
         first.add( id1 );
         first.add( id2 );
         first.add( id3 );
-        first.add( id8 );
-        first.add( id9 );
+
+
 
         InOrderIterator second = new InOrderIterator( 100 );
         second.add( id1 );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/16455b87/stack/core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/log4j.properties b/stack/core/src/test/resources/log4j.properties
index 4c75404..9282771 100644
--- a/stack/core/src/test/resources/log4j.properties
+++ b/stack/core/src/test/resources/log4j.properties
@@ -18,7 +18,7 @@
 # and the pattern to %c instead of %l.  (%l is slower.)
 
 # output messages into a rolling log file as well as stdout
-log4j.rootLogger=INFO,stdout
+log4j.rootLogger=DEBUG,stdout
 
 # stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender