You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2017/10/12 14:54:32 UTC

svn commit: r1811973 - /jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java

Author: mreutegg
Date: Thu Oct 12 14:54:31 2017
New Revision: 1811973

URL: http://svn.apache.org/viewvc?rev=1811973&view=rev
Log:
OAK-2621: Too many reads for child nodes

Add ignored test

Modified:
    jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java

Modified: jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java?rev=1811973&r1=1811972&r2=1811973&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java Thu Oct 12 14:54:31 2017
@@ -3548,6 +3548,31 @@ public class DocumentNodeStoreTest {
         after.compareAgainstBaseState(before, new DefaultNodeStateDiff());
     }
 
+    // OAK-2621
+    @Ignore("OAK-2621")
+    @Test
+    public void getChildNodeCount() throws Exception {
+        CountingDocumentStore store = new CountingDocumentStore(new MemoryDocumentStore());
+        DocumentNodeStore ns = builderProvider.newBuilder().setAsyncDelay(0)
+                .setDocumentStore(store).getNodeStore();
+        NodeBuilder builder = ns.getRoot().builder();
+        for (int i = 0; i < 100; i++) {
+            builder.child("test").child("node-" + i);
+        }
+        merge(ns, builder);
+
+        ns.getNodeChildrenCache().invalidateAll();
+        store.resetCounters();
+        builder = ns.getRoot().builder();
+        for (int i = 0; i < 100; i++) {
+            NodeBuilder test = builder.child("test");
+            test.child("node-" + i).remove();
+            test.getChildNodeCount(1);
+        }
+        // must read the children of /test only once
+        assertEquals(1, store.getNumQueryCalls(NODES));
+    }
+
     private static class WriteCountingStore extends MemoryDocumentStore {
         private final ThreadLocal<Boolean> createMulti = new ThreadLocal<>();
         int count;