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 ca...@apache.org on 2016/07/26 12:11:04 UTC

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

Author: catholicon
Date: Tue Jul 26 12:11:04 2016
New Revision: 1754117

URL: http://svn.apache.org/viewvc?rev=1754117&view=rev
Log:
OAK-4601: Node cache shouldn't get duplicated entries with differing branch flags for branch commits

Although, there wasn't any valid issue identified... adding test case nonetheless

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java?rev=1754117&r1=1754116&r2=1754117&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java Tue Jul 26 12:11:04 2016
@@ -2580,6 +2580,28 @@ public class DocumentNodeStoreTest {
         assertTrue(diff.modified.contains("/parent/node-x/child"));
     }
 
+    // OAK-4601
+    @Test
+    public void nodeCacheForBranchCommit() throws Exception {
+        DocumentNodeStore ns = builderProvider.newBuilder().getNodeStore();
+
+        NodeBuilder b1 = ns.getRoot().builder();
+
+        final int NUM_CHILDREN = 3*DocumentRootBuilder.UPDATE_LIMIT + 1;
+        //this would push cache entries -> #nodes=3*
+        for (int i = 0; i < NUM_CHILDREN; i++) {
+            b1.child("child" + i);
+        }
+
+        //this would push cache entries
+        for (int i = 0; i < NUM_CHILDREN; i++) {
+            b1.getChildNode("child" + i);
+        }
+
+        //must not have duplicated cache entries
+        assertTrue(ns.getNodeCacheStats().getElementCount() < 2*NUM_CHILDREN);
+    }
+
     @Test
     public void lastRevWithRevisionVector() throws Exception {
         MemoryDocumentStore store = new MemoryDocumentStore();