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()))) {