Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Reading a node state with an old revision from a document can be expensive when many changes happened on a property in the meantime.
A typical stack trace looks like this:
at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getPreviousDocument(NodeDocument.java:1337) at org.apache.jackrabbit.oak.plugins.document.PropertyHistory$1.apply(PropertyHistory.java:70) at org.apache.jackrabbit.oak.plugins.document.PropertyHistory$1.apply(PropertyHistory.java:63) at com.google.common.collect.Iterators$8.transform(Iterators.java:794) at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:646) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.Iterators$PeekingImpl.hasNext(Iterators.java:1139) at org.apache.jackrabbit.oak.plugins.document.PropertyHistory$2.refillQueue(PropertyHistory.java:121) at org.apache.jackrabbit.oak.plugins.document.PropertyHistory$2.computeNext(PropertyHistory.java:96) at org.apache.jackrabbit.oak.plugins.document.PropertyHistory$2.computeNext(PropertyHistory.java:88) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at org.apache.jackrabbit.oak.plugins.document.ValueMap$1$3.nextIterator(ValueMap.java:105) at org.apache.jackrabbit.oak.plugins.document.util.MergeSortedIterators.fetchNextIterator(MergeSortedIterators.java:98) at org.apache.jackrabbit.oak.plugins.document.util.MergeSortedIterators.next(MergeSortedIterators.java:85) at com.google.common.collect.Iterators$PeekingImpl.peek(Iterators.java:1162) at org.apache.jackrabbit.oak.plugins.document.util.MergeSortedIterators.adjustFirst(MergeSortedIterators.java:117) at org.apache.jackrabbit.oak.plugins.document.util.MergeSortedIterators.next(MergeSortedIterators.java:78) at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getLatestValue(NodeDocument.java:1972) at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getNodeAtRevision(NodeDocument.java:990) at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.readNode(DocumentNodeStore.java:1079)
The read operation goes through the property history until it finds the most recent change. The old the read revision, the more changes are scanned.