jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1574463 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document: DocumentMK.java DocumentNodeState.java NodeDocument.java
Date Wed, 05 Mar 2014 12:59:41 GMT
Author: mreutegg
Date: Wed Mar  5 12:59:41 2014
New Revision: 1574463

URL: http://svn.apache.org/r1574463
Log:
OAK-1429: Slow event listeners do not scale as expected

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1574463&r1=1574462&r2=1574463&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
Wed Mar  5 12:59:41 2014
@@ -55,7 +55,7 @@ public class DocumentMK implements Micro
      * The threshold where special handling for many child node starts.
      */
     static final int MANY_CHILDREN_THRESHOLD = Integer.getInteger(
-            "oak.documentMK.manyChildren", 50);
+            "oak.documentMK.manyChildren", 10);
     
     /**
      * Enable the LIRS cache.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1574463&r1=1574462&r2=1574463&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
Wed Mar  5 12:59:41 2014
@@ -52,6 +52,7 @@ import com.google.common.collect.Iterato
 import com.google.common.collect.Maps;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.MANY_CHILDREN_THRESHOLD;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 
 /**
@@ -71,12 +72,6 @@ class DocumentNodeState extends Abstract
      */
     static final int MAX_FETCH_SIZE = INITIAL_FETCH_SIZE << 4;
 
-    /**
-     * Number of child nodes beyond which {@link DocumentNodeStore#}
-     * is used for diffing.
-     */
-    public static final int LOCAL_DIFF_THRESHOLD = 10;
-
     private final DocumentNodeStore store;
 
     final String path;
@@ -246,7 +241,7 @@ class DocumentNodeState extends Abstract
                     if (lastRevision.equals(mBase.lastRevision)) {
                         // no differences
                         return true;
-                    } else if (getChildNodeCount(LOCAL_DIFF_THRESHOLD) > LOCAL_DIFF_THRESHOLD)
{
+                    } else if (getChildNodeCount(MANY_CHILDREN_THRESHOLD) > MANY_CHILDREN_THRESHOLD)
{
                         // use DocumentNodeStore compare when there are many children
                         return dispatch(store.diffChildren(this, mBase), mBase, diff);
                     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java?rev=1574463&r1=1574462&r2=1574463&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
Wed Mar  5 12:59:41 2014
@@ -55,7 +55,7 @@ import static org.apache.jackrabbit.oak.
 /**
  * A document storing data about a node.
  */
-public class NodeDocument extends Document implements CachedNodeDocument{
+final public class NodeDocument extends Document implements CachedNodeDocument{
 
     /**
      * Marker document, which indicates the document does not exist.
@@ -361,10 +361,6 @@ public class NodeDocument extends Docume
         // check local map first
         Map<Revision, String> local = getLocalCommitRoot();
         String depth = local.get(revision);
-        if (depth == null) {
-            // check full map
-            depth = getCommitRoot().get(revision);
-        }
         if (depth != null) {
             if (depth.equals("0")) {
                 return "/";
@@ -372,9 +368,15 @@ public class NodeDocument extends Docume
             String p = Utils.getPathFromId(getId());
             return PathUtils.getAncestorPath(p,
                     PathUtils.getDepth(p) - Integer.parseInt(depth));
-        } else {
-            return null;
         }
+        // check previous
+        for (NodeDocument prev : getPreviousDocs(COMMIT_ROOT, revision)) {
+            String path = prev.getCommitRootPath(revision);
+            if (path != null) {
+                return path;
+            }
+        }
+        return null;
     }
 
     /**
@@ -826,7 +828,7 @@ public class NodeDocument extends Docume
     @Nonnull
     SortedMap<Revision, String> getLocalMap(String key) {
         @SuppressWarnings("unchecked")
-        SortedMap<Revision, String> map = (SortedMap<Revision, String>) get(key);
+        SortedMap<Revision, String> map = (SortedMap<Revision, String>) data.get(key);
         if (map == null) {
             map = ValueMap.EMPTY;
         }
@@ -1095,6 +1097,11 @@ public class NodeDocument extends Docume
         Revision latestRev = null;
         for (Map.Entry<Revision, String> entry : valueMap.entrySet()) {
             Revision propRev = entry.getKey();
+            // ignore revisions newer than readRevision
+            // -> these are not visible anyway
+            if (isRevisionNewer(context, propRev, readRevision)) {
+                continue;
+            }
             // resolve revision
             NodeDocument commitRoot = getCommitRoot(propRev);
             if (commitRoot == null) {



Mime
View raw message