jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1515736 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/
Date Tue, 20 Aug 2013 08:23:47 GMT
Author: mreutegg
Date: Tue Aug 20 08:23:46 2013
New Revision: 1515736

URL: http://svn.apache.org/r1515736
Log:
OAK-962: RootFuzzIT fails on MongoMK with seed -1091889749
- Fix in MongoMK
- Enabled test in ManyChildrenIT

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ManyChildrenIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java?rev=1515736&r1=1515735&r2=1515736&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
Tue Aug 20 08:23:46 2013
@@ -515,21 +515,34 @@ public class MongoMK implements MicroKer
         // as the starting point
         String from = Utils.getKeyLowerLimit(path);
         String to = Utils.getKeyUpperLimit(path);
-        List<NodeDocument> list = store.query(Collection.NODES,
-                from, to, limit);
+        List<NodeDocument> list;
         Children c = new Children();
-        Set<Revision> validRevisions = new HashSet<Revision>();
-        if (list.size() >= limit) {
+        int rawLimit = limit;
+        do {
+            c.children.clear();
             c.hasMore = true;
-        }
-        for (NodeDocument doc : list) {
-            // filter out deleted children
-            if (doc.getLiveRevision(this, store, rev, validRevisions) == null) {
-                continue;
-            }
-            String p = Utils.getPathFromId(doc.getId());
-            c.children.add(p);
-        }
+            list = store.query(Collection.NODES,
+                    from, to, rawLimit);
+            Set<Revision> validRevisions = new HashSet<Revision>();
+            for (NodeDocument doc : list) {
+                // filter out deleted children
+                if (doc.getLiveRevision(this, store, rev, validRevisions) == null) {
+                    continue;
+                }
+                String p = Utils.getPathFromId(doc.getId());
+                if (c.children.size() < limit) {
+                    // add to children until limit is reached
+                    c.children.add(p);
+                }
+            }
+            if (list.size() < rawLimit) {
+                // fewer documents returned than requested
+                // -> no more documents
+                c.hasMore = false;
+            }
+            // double rawLimit for next round
+            rawLimit = (int) Math.min(((long) rawLimit) * 2, Integer.MAX_VALUE);
+        } while (c.children.size() < limit && c.hasMore);
         return c;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java?rev=1515736&r1=1515735&r2=1515736&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
Tue Aug 20 08:23:46 2013
@@ -122,8 +122,7 @@ public class Node implements CacheValue 
     static class Children implements CacheValue {
 
         final ArrayList<String> children = new ArrayList<String>();
-        boolean hasMore;
-        long offset;
+        boolean hasMore = false;
 
         @Override
         public int getMemory() {

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ManyChildrenIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ManyChildrenIT.java?rev=1515736&r1=1515735&r2=1515736&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ManyChildrenIT.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ManyChildrenIT.java
Tue Aug 20 08:23:46 2013
@@ -58,7 +58,6 @@ public class ManyChildrenIT extends Abst
         session2.logout();
     }
 
-    @Ignore("OAK-962")
     @Test
     public void addRemoveNodes() throws Exception {
         int numNodes = 101;



Mime
View raw message