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/27 10:33:30 UTC
svn commit: r1754239 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
Author: catholicon
Date: Wed Jul 27 10:33:30 2016
New Revision: 1754239
URL: http://svn.apache.org/viewvc?rev=1754239&view=rev
Log:
OAK-4600: Node children cache shouldn't get duplicated entries with differing branch flags for branch commits
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=1754239&r1=1754238&r2=1754239&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 Wed Jul 27 10:33:30 2016
@@ -2580,6 +2580,27 @@ public class DocumentNodeStoreTest {
assertTrue(diff.modified.contains("/parent/node-x/child"));
}
+ // OAK-4600
+ @Test
+ public void nodeChildrenCacheForBranchCommit() throws Exception {
+ DocumentNodeStore ns = builderProvider.newBuilder().getNodeStore();
+
+ NodeBuilder b1 = ns.getRoot().builder();
+
+ //this would push children cache entries as childX->subChildX
+ for (int i = 0; i < DocumentRootBuilder.UPDATE_LIMIT + 1; i++) {
+ b1.child("child" + i).child("subChild" + i);
+ }
+
+ //The fetch would happen on "br" format of revision
+ for (int i = 0; i < DocumentRootBuilder.UPDATE_LIMIT + 1; i++) {
+ Iterables.size(b1.getChildNode("child" + i).getChildNodeNames());
+ }
+
+ //must not have duplicated cache entries
+ assertTrue(ns.getNodeChildrenCacheStats().getElementCount() < 2*DocumentRootBuilder.UPDATE_LIMIT);
+ }
+
// OAK-4601
@Test
public void nodeCacheForBranchCommit() throws Exception {
@@ -2588,7 +2609,7 @@ public class DocumentNodeStoreTest {
NodeBuilder b1 = ns.getRoot().builder();
final int NUM_CHILDREN = 3*DocumentRootBuilder.UPDATE_LIMIT + 1;
- //this would push cache entries -> #nodes=3*
+ //this would push node cache entries for children
for (int i = 0; i < NUM_CHILDREN; i++) {
b1.child("child" + i);
}