jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1513797 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
Date Wed, 14 Aug 2013 10:16:53 GMT
Author: thomasm
Date: Wed Aug 14 10:16:53 2013
New Revision: 1513797

URL: http://svn.apache.org/r1513797
Log:
OAK-858 NodeBuilder.getChildNodeCount performance and scalability (bugfix when there are many
child nodes)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java?rev=1513797&r1=1513796&r2=1513797&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
Wed Aug 14 10:16:53 2013
@@ -267,6 +267,17 @@ public abstract class AbstractNodeState 
         }
 
         // TODO inefficient unless there are very few child nodes
+
+        // compare the exact child node count
+        // (before, we only compared up to 20 entries)
+        c1 = getChildNodeCount(Long.MAX_VALUE);
+        c2 = other.getChildNodeCount(Long.MAX_VALUE);
+        if (c1 != c2) {
+            return false;
+        }
+        
+        // compare all child nodes recursively (this is potentially very slow,
+        // as it recursively calls equals)
         for (ChildNodeEntry entry : getChildNodeEntries()) {
             if (!entry.getNodeState().equals(
                     other.getChildNode(entry.getName()))) {



Mime
View raw message