jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1505988 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/...
Date Tue, 23 Jul 2013 11:45:46 GMT
Author: mduerig
Date: Tue Jul 23 11:45:46 2013
New Revision: 1505988

URL: http://svn.apache.org/r1505988
Log:
OAK-927 Concurrent commits may cause duplicate observation events

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreCacheTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/JournalTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MergeTest.java
    jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java Tue Jul 23 11:45:46 2013
@@ -253,8 +253,7 @@ public class RootImpl implements Root {
             public CommitFailedException run() {
                 try {
                     NodeState base = branch.getBase();
-                    NodeState newHead = branch.merge(getCommitHook());
-                    postHook.contentChanged(base, newHead);
+                    NodeState newHead = branch.merge(getCommitHook(), postHook);
                     return null;
                 } catch (CommitFailedException e) {
                     return e;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java Tue Jul 23 11:45:46 2013
@@ -38,7 +38,7 @@ import org.apache.jackrabbit.oak.spi.sta
 /**
  * TODO document
  */
-class JsopDiff implements NodeStateDiff {
+public class JsopDiff implements NodeStateDiff {
 
     private final KernelNodeStore store;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java Tue Jul 23 11:45:46 2013
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeStoreBranch;
 import org.apache.jackrabbit.oak.spi.state.ConflictAnnotatingRebaseDiff;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -135,43 +136,48 @@ class KernelNodeStoreBranch extends Abst
     }
 
     @Override
-    public NodeState merge(CommitHook hook) throws CommitFailedException {
+    public NodeState merge(CommitHook hook, PostCommitHook committed) throws CommitFailedException {
         checkNotMerged();
-        NodeState toCommit = checkNotNull(hook).processCommit(base, head);
-        NodeState oldRoot = head;
-        head = toCommit;
+        synchronized (this) {
+            rebase();
+            NodeState toCommit = checkNotNull(hook).processCommit(base, head);
+            NodeState oldRoot = head;
+            head = toCommit;
 
-        try {
-            if (head.equals(base)) {
-                // Nothing was written to this branch: return base state
-                head = null;  // Mark as merged
-                return base;
-            } else {
-                NodeState newRoot;
-                JsopDiff diff = new JsopDiff(store);
-                if (headRevision == null) {
-                    // no branch created yet, commit directly
-                    head.compareAgainstBaseState(base, diff);
-                    newRoot = store.commit(diff.toString(), base.getRevision());
+            try {
+                if (head.equals(base)) {
+                    // Nothing was written to this branch: return base state
+                    head = null;  // Mark as merged
+                    committed.contentChanged(base, base);
+                    return base;
                 } else {
-                    // commit into branch and merge
-                    head.compareAgainstBaseState(store.getRootState(headRevision), diff);
-                    String jsop = diff.toString();
-                    if (!jsop.isEmpty()) {
-                        headRevision = store.getKernel().commit(
-                                "", jsop, headRevision, null);
+                    NodeState newRoot;
+                    JsopDiff diff = new JsopDiff(store);
+                    if (headRevision == null) {
+                        // no branch created yet, commit directly
+                        head.compareAgainstBaseState(base, diff);
+                        newRoot = store.commit(diff.toString(), base.getRevision());
+                    } else {
+                        // commit into branch and merge
+                        head.compareAgainstBaseState(store.getRootState(headRevision), diff);
+                        String jsop = diff.toString();
+                        if (!jsop.isEmpty()) {
+                            headRevision = store.getKernel().commit(
+                                    "", jsop, headRevision, null);
+                        }
+                        newRoot = store.merge(headRevision);
+                        headRevision = null;
                     }
-                    newRoot = store.merge(headRevision);
-                    headRevision = null;
+                    head = null;  // Mark as merged
+                    committed.contentChanged(base, newRoot);
+                    return newRoot;
                 }
-                head = null;  // Mark as merged
-                return newRoot;
+            } catch (MicroKernelException e) {
+                head = oldRoot;
+                throw new CommitFailedException(
+                        "Kernel", 1,
+                        "Failed to merge changes to the underlying MicroKernel", e);
             }
-        } catch (MicroKernelException e) {
-            head = oldRoot;
-            throw new CommitFailedException(
-                    "Kernel", 1,
-                    "Failed to merge changes to the underlying MicroKernel", e);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java Tue Jul 23 11:45:46 2013
@@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.EditorDiff;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -115,7 +116,7 @@ public class AsyncIndexUpdate implements
                                 throw CONCURRENT_UPDATE;
                             }
                         }
-                    });
+                    }, PostCommitHook.EMPTY);
                 } catch (CommitFailedException e) {
                     if (e != CONCURRENT_UPDATE) {
                         exception = e;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java Tue Jul 23 11:45:46 2013
@@ -16,6 +16,12 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.Maps.newHashMap;
+import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
@@ -25,20 +31,14 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
 import com.google.common.io.ByteStreams;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeStore;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeStoreBranch;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Maps.newHashMap;
-import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
-
 /**
  * Basic in-memory node store implementation. Useful as a base class for
  * more complex functionality.
@@ -121,16 +121,14 @@ public class MemoryNodeStore extends Abs
         }
 
         @Override
-        public NodeState merge(CommitHook hook) throws CommitFailedException {
+        public NodeState merge(CommitHook hook, PostCommitHook committed) throws CommitFailedException {
+            // TODO: rebase();
             checkNotMerged();
-            while (!store.root.compareAndSet(
-                    base, ModifiedNodeState.squeeze(
-                            checkNotNull(hook).processCommit(base, root)))) {
-                // TODO: rebase();
-                throw new UnsupportedOperationException();
-            }
+            NodeState merged = ModifiedNodeState.squeeze(checkNotNull(hook).processCommit(base, root));
+            store.root.set(merged);
             root = null; // Mark as merged
-            return store.getRoot();
+            committed.contentChanged(base, merged);
+            return merged;
         }
 
         @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java Tue Jul 23 11:45:46 2013
@@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.version.VersionConstants;
 import org.apache.jackrabbit.oak.spi.commit.EditorHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -76,7 +77,7 @@ public class InitialContent implements R
         NodeStoreBranch branch = store.branch();
         branch.setRoot(root.getNodeState());
         try {
-            branch.merge(EmptyHook.INSTANCE);
+            branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java Tue Jul 23 11:45:46 2013
@@ -29,6 +29,7 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeStoreBranch;
 import org.apache.jackrabbit.oak.spi.state.ConflictAnnotatingRebaseDiff;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -93,7 +94,7 @@ class SegmentNodeStoreBranch extends Abs
         }
     }
 
-    private synchronized long optimisticMerge(CommitHook hook)
+    private synchronized long optimisticMerge(CommitHook hook, PostCommitHook committed)
             throws CommitFailedException, InterruptedException {
         long timeout = 1;
 
@@ -119,6 +120,7 @@ class SegmentNodeStoreBranch extends Abs
             } else if (store.setHead(base, newHead)) {
                 base = newHead;
                 head = newHead;
+                committed.contentChanged(originalBase.getChildNode(ROOT), newHead.getChildNode(ROOT));
                 return -1;
             }
 
@@ -140,7 +142,7 @@ class SegmentNodeStoreBranch extends Abs
         return MILLISECONDS.convert(timeout, NANOSECONDS);
     }
 
-    private synchronized void pessimisticMerge(CommitHook hook, long timeout)
+    private synchronized void pessimisticMerge(CommitHook hook, PostCommitHook committed, long timeout)
             throws CommitFailedException {
         while (true) {
             SegmentNodeState before = store.getHead();
@@ -176,6 +178,7 @@ class SegmentNodeStoreBranch extends Abs
                     if (store.setHead(after, newHead)) {
                         base = newHead;
                         head = newHead;
+                        committed.contentChanged(originalBase.getChildNode(ROOT), newHead.getChildNode(ROOT));
                         return;
                     } else {
                         // something else happened, perhaps a timeout, so
@@ -189,13 +192,13 @@ class SegmentNodeStoreBranch extends Abs
     }
 
     @Override @Nonnull
-    public synchronized NodeState merge(CommitHook hook)
+    public synchronized NodeState merge(CommitHook hook, PostCommitHook committed)
             throws CommitFailedException {
         if (base != head) {
             try {
-                long timeout = optimisticMerge(hook);
+                long timeout = optimisticMerge(hook, committed);
                 if (timeout >= 0) {
-                    pessimisticMerge(hook, timeout);
+                    pessimisticMerge(hook, committed, timeout);
                 }
             } catch (InterruptedException e) {
                 throw new CommitFailedException(

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java Tue Jul 23 11:45:46 2013
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.oak.core.Ro
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -59,7 +60,7 @@ class PrivilegeInitializer implements Re
             NodeStoreBranch branch = store.branch();
             try {
                 branch.setRoot(root.getNodeState());
-                branch.merge(EmptyHook.INSTANCE);
+                branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
             } catch (CommitFailedException e) {
                 log.error("Failed to initialize privilege content ", e);
                 throw new RuntimeException(e);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java Tue Jul 23 11:45:46 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.security.user;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import javax.annotation.Nonnull;
 import javax.jcr.RepositoryException;
 
@@ -46,8 +48,6 @@ import org.apache.jackrabbit.oak.util.No
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 /**
  * Creates initial set of users to be present in a given workspace. This
  * implementation uses the {@code UserManager} such as defined by the
@@ -95,7 +95,7 @@ class UserInitializer implements Workspa
         NodeStoreBranch branch = store.branch();
         branch.setRoot(workspaceRoot);
         try {
-            branch.merge(EmptyHook.INSTANCE);
+            branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java Tue Jul 23 11:45:46 2013
@@ -25,6 +25,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -42,7 +43,7 @@ public final class OakInitializer {
         NodeState before = branch.getHead();
         branch.setRoot(initializer.initialize(before));
         try {
-            branch.merge(new EditorHook(new IndexUpdateProvider(indexEditor)));
+            branch.merge(new EditorHook(new IndexUpdateProvider(indexEditor)), PostCommitHook.EMPTY);
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }
@@ -61,7 +62,7 @@ public final class OakInitializer {
         }
         branch.setRoot(root);
         try {
-            branch.merge(new EditorHook(new IndexUpdateProvider(indexEditor)));
+            branch.merge(new EditorHook(new IndexUpdateProvider(indexEditor)), PostCommitHook.EMPTY);
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java Tue Jul 23 11:45:46 2013
@@ -20,6 +20,7 @@ import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 
 /**
  * An instance of this class represents a private branch of the tree in a
@@ -81,14 +82,17 @@ public interface NodeStoreBranch {
 
     /**
      * Merges the changes in this branch to the main content tree.
+     * Merging is done by rebasing the changes in this branch on top of
+     * the current head revision followed by a fast forward merge.
      *
      * @param hook the commit hook to apply while merging changes
+     * @param committed the post commit hook to call after a successful merge
      * @return the node state resulting from the merge.
      * @throws CommitFailedException if the merge failed
      * @throws IllegalStateException if the branch is already merged
      */
     @Nonnull
-    NodeState merge(@Nonnull CommitHook hook) throws CommitFailedException;
+    NodeState merge(@Nonnull CommitHook hook, PostCommitHook committed) throws CommitFailedException;
 
     /**
      * Rebase the changes from this branch on top of the current

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java Tue Jul 23 11:45:46 2013
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.mk.core.Mic
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -52,7 +53,7 @@ public class KernelNodeBuilderTest {
         NodeBuilder builder = branch.getHead().builder();
         builder.child("x").child("y").child("z");
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
     private static void run(NodeStore store) throws CommitFailedException {
@@ -75,7 +76,7 @@ public class KernelNodeBuilderTest {
         assertFalse("child node x/y/z not should not be present", builder
                 .child("x").child("y").hasChildNode("z"));
 
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java Tue Jul 23 11:45:46 2013
@@ -18,6 +18,12 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static org.apache.jackrabbit.oak.api.Type.LONG;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -27,6 +33,7 @@ import org.apache.jackrabbit.mk.core.Mic
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -36,12 +43,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
-import static org.apache.jackrabbit.oak.api.Type.LONG;
-
 public class KernelNodeStateTest {
 
     private NodeState state;
@@ -60,7 +61,7 @@ public class KernelNodeStateTest {
         builder.child("z");
         branch.setRoot(builder.getNodeState());
 
-        state = branch.merge(EmptyHook.INSTANCE);
+        state = branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
     @After

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreCacheTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreCacheTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreCacheTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreCacheTest.java Tue Jul 23 11:45:46 2013
@@ -18,6 +18,9 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.InputStream;
 
 import javax.annotation.Nonnull;
@@ -26,6 +29,7 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -33,9 +37,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Tests if cache is used for repeated reads on unmodified subtree.
  * See also OAK-591.
@@ -64,7 +65,7 @@ public class KernelNodeStoreCacheTest {
         b.child("e");
         branch.setRoot(builder.getNodeState());
 
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
     /**
@@ -143,7 +144,7 @@ public class KernelNodeStoreCacheTest {
         NodeBuilder builder = branch.getHead().builder();
         builder.child("a").setProperty("foo", "bar");
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
     private void readTree(NodeState root) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java Tue Jul 23 11:45:46 2013
@@ -18,9 +18,14 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -30,10 +35,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
 public class LargeKernelNodeStateTest {
 
     private static final int N = KernelNodeState.MAX_CHILD_NODE_NAMES;
@@ -52,7 +53,7 @@ public class LargeKernelNodeStateTest {
         }
         branch.setRoot(builder.getNodeState());
 
-        state = branch.merge(EmptyHook.INSTANCE);
+        state = branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
     }
 
     @After

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java Tue Jul 23 11:45:46 2013
@@ -37,6 +37,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -85,7 +86,7 @@ public class NodeStoreTest {
         test.child("y");
         test.child("z");
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
         root = store.getRoot();
     }
 
@@ -144,7 +145,7 @@ public class NodeStoreTest {
         assertFalse(testState.getChildNode("newNode").exists());
         assertTrue(testState.getChildNode("x").exists());
 
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         // Assert changes are present in the trunk
         testState = store.getRoot().getChildNode("test");
@@ -179,7 +180,7 @@ public class NodeStoreTest {
 
         NodeStoreBranch branch = store.branch();
         branch.setRoot(newRoot);
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
         store.getRoot(); // triggers the observer
 
         NodeState before = states[0];
@@ -217,7 +218,7 @@ public class NodeStoreTest {
                 testBuilder.child("fromHook");
                 return rootBuilder.getNodeState();
             }
-        });
+        }, PostCommitHook.EMPTY);
 
         NodeState test = store.getRoot().getChildNode("test");
         assertTrue(test.getChildNode("newNode").exists());
@@ -236,7 +237,7 @@ public class NodeStoreTest {
             parent.child("child-" + i);
         }
         branch.setRoot(root.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         NodeState base = store.getRoot();
         branch = store.branch();
@@ -244,7 +245,7 @@ public class NodeStoreTest {
         parent = root.child("parent");
         parent.child("child-new");
         branch.setRoot(root.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         Diff diff = new Diff();
         store.getRoot().compareAgainstBaseState(base, diff);
@@ -256,7 +257,7 @@ public class NodeStoreTest {
         base = store.getRoot();
         branch = store.branch();
         branch.move("/parent/child-new", "/parent/child-moved");
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         diff = new Diff();
         store.getRoot().compareAgainstBaseState(base, diff);
@@ -274,7 +275,7 @@ public class NodeStoreTest {
         parent.child("child-moved").setProperty(
                 new MultiStringPropertyState("bar", Arrays.asList("value")));
         branch.setRoot(root.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         diff = new Diff();
         store.getRoot().compareAgainstBaseState(base, diff);
@@ -293,7 +294,7 @@ public class NodeStoreTest {
         parent.setProperty(new MultiStringPropertyState(
                 "bar", Arrays.asList("value")));
         branch.setRoot(root.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         diff = new Diff();
         store.getRoot().compareAgainstBaseState(base, diff);
@@ -310,7 +311,7 @@ public class NodeStoreTest {
         parent = root.child("parent");
         parent.getChildNode("child-moved").remove();
         branch.setRoot(root.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         diff = new Diff();
         store.getRoot().compareAgainstBaseState(base, diff);
@@ -346,7 +347,7 @@ public class NodeStoreTest {
 
         builder.child("foo").child(":bar").child("quz").setProperty("p", "v");
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         NodeState after = store.getRoot();
         Diff diff = new Diff();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java Tue Jul 23 11:45:46 2013
@@ -29,6 +29,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexLookup;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.query.PropertyValues;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -82,7 +83,7 @@ public class AsyncIndexUpdateTest {
 
         // merge it back in
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
         async.run();
@@ -126,7 +127,7 @@ public class AsyncIndexUpdateTest {
 
         // merge it back in
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
         async.run();
@@ -181,7 +182,7 @@ public class AsyncIndexUpdateTest {
 
         // merge it back in
         branch.setRoot(builder.getNodeState());
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
         async.run();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java Tue Jul 23 11:45:46 2013
@@ -41,6 +41,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.query.ast.SelectorImpl;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer;
 import org.apache.jackrabbit.oak.spi.query.Cursor;
 import org.apache.jackrabbit.oak.spi.query.Cursors;
@@ -81,7 +82,7 @@ public class NodeTypeIndexTest {
 
         branch.setRoot(root.getNodeState());
         branch.merge(new EditorHook(new IndexUpdateProvider(
-                new PropertyIndexEditorProvider())));
+                new PropertyIndexEditorProvider())), PostCommitHook.EMPTY);
 
         NodeState rootState = store.getRoot();
         NodeTypeIndex index = new NodeTypeIndex();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/JournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/JournalTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/JournalTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/JournalTest.java Tue Jul 23 11:45:46 2013
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.segment.memory.MemoryStore;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -49,7 +50,7 @@ public class JournalTest {
 
         NodeStoreBranch branch = root.branch();
         branch.setRoot(newState);
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertEquals(newState, root.getRoot());
         assertEquals(oldState, left.getRoot());
@@ -78,7 +79,7 @@ public class JournalTest {
 
         NodeStoreBranch branch = left.branch();
         branch.setRoot(newState);
-        branch.merge(EmptyHook.INSTANCE);
+        branch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertEquals(oldState, root.getRoot());
         assertEquals(newState, left.getRoot());
@@ -107,7 +108,7 @@ public class JournalTest {
 
         NodeStoreBranch leftBranch = left.branch();
         leftBranch.setRoot(leftState);
-        leftBranch.merge(EmptyHook.INSTANCE);
+        leftBranch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertEquals(oldState, root.getRoot());
         assertEquals(leftState, left.getRoot());
@@ -124,7 +125,7 @@ public class JournalTest {
 
         NodeStoreBranch rightBranch = right.branch();
         rightBranch.setRoot(rightState);
-        rightBranch.merge(EmptyHook.INSTANCE);
+        rightBranch.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         store.getJournal("right").merge();
         NodeState newState = root.getRoot();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MergeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MergeTest.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MergeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MergeTest.java Tue Jul 23 11:45:46 2013
@@ -29,6 +29,7 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.plugins.segment.memory.MemoryStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -46,14 +47,14 @@ public class MergeTest {
 
         NodeStoreBranch a = store.branch();
         a.setRoot(a.getHead().builder().setProperty("foo", "abc").getNodeState());
-        a.merge(EmptyHook.INSTANCE);
+        a.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertTrue(store.getRoot().hasProperty("foo"));
         assertFalse(store.getRoot().hasProperty("bar"));
 
         NodeStoreBranch b = store.branch();
         b.setRoot(b.getHead().builder().setProperty("bar", "xyz").getNodeState());
-        b.merge(EmptyHook.INSTANCE);
+        b.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertTrue(store.getRoot().hasProperty("foo"));
         assertTrue(store.getRoot().hasProperty("bar"));
@@ -72,12 +73,12 @@ public class MergeTest {
         assertFalse(store.getRoot().hasProperty("foo"));
         assertFalse(store.getRoot().hasProperty("bar"));
 
-        a.merge(EmptyHook.INSTANCE);
+        a.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertTrue(store.getRoot().hasProperty("foo"));
         assertFalse(store.getRoot().hasProperty("bar"));
 
-        b.merge(EmptyHook.INSTANCE);
+        b.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
 
         assertTrue(store.getRoot().hasProperty("foo"));
         assertTrue(store.getRoot().hasProperty("bar"));
@@ -98,7 +99,7 @@ public class MergeTest {
                         NodeBuilder builder = a.getHead().builder();
                         builder.setProperty("foo", "abc" + i);
                         a.setRoot(builder.getNodeState());
-                        a.merge(EmptyHook.INSTANCE);
+                        a.merge(EmptyHook.INSTANCE, PostCommitHook.EMPTY);
                         semaphore.release();
                     } catch (CommitFailedException e) {
                         fail();
@@ -127,7 +128,7 @@ public class MergeTest {
                 }
                 return after;
             }
-        });
+        }, PostCommitHook.EMPTY);
 
         assertTrue(store.getRoot().hasProperty("foo"));
         assertTrue(store.getRoot().hasProperty("bar"));

Modified: jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java?rev=1505988&r1=1505987&r2=1505988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java (original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java Tue Jul 23 11:45:46 2013
@@ -71,6 +71,7 @@ import org.apache.jackrabbit.oak.api.Typ
 import org.apache.jackrabbit.oak.plugins.name.NamespaceConstants;
 import org.apache.jackrabbit.oak.plugins.nodetype.RegistrationEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.commit.PostCommitHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -176,7 +177,7 @@ public class RepositoryUpgrade {
             copyWorkspaces(builder);
 
             branch.setRoot(builder.getNodeState());
-            branch.merge(new EditorHook(new RegistrationEditorProvider())); // TODO: default hooks?
+            branch.merge(new EditorHook(new RegistrationEditorProvider()), PostCommitHook.EMPTY); // TODO: default hooks?
         } catch (Exception e) {
             throw new RepositoryException("Failed to copy content", e);
         }



Mime
View raw message