You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2015/09/01 11:13:35 UTC

svn commit: r1700430 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java

Author: mduerig
Date: Tue Sep  1 09:13:34 2015
New Revision: 1700430

URL: http://svn.apache.org/r1700430
Log:
OAK-2849: Improve revision gc on SegmentMK
Resolve conflicts in SegmentCompactionIT avoiding to clutter repository with :conflict nodes

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java?rev=1700430&r1=1700429&r2=1700430&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java Tue Sep  1 09:13:34 2015
@@ -74,12 +74,15 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.cache.CacheStats;
 import org.apache.jackrabbit.oak.commons.jmx.AnnotatedStandardMBean;
+import org.apache.jackrabbit.oak.plugins.commit.ConflictHook;
+import org.apache.jackrabbit.oak.plugins.commit.DefaultConflictHandler;
 import org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy;
 import org.apache.jackrabbit.oak.plugins.segment.compaction.DefaultCompactionStrategyMBean;
 import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
 import org.apache.jackrabbit.oak.plugins.segment.file.FileStoreGCMonitor;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
-import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.gc.GCMonitor;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -432,7 +435,14 @@ public class SegmentCompactionIT {
                 modify(nodeStore, root);
             }
             if (!cancelled) {
-                nodeStore.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+                try {
+                    CommitHook commitHook = rnd.nextBoolean()
+                        ? new CompositeHook(new ConflictHook(DefaultConflictHandler.OURS))
+                        : new CompositeHook(new ConflictHook(DefaultConflictHandler.THEIRS));
+                    nodeStore.merge(root, commitHook, CommitInfo.EMPTY);
+                } catch (CommitFailedException e) {
+                    LOG.warn("Commit failed: {}", e.getMessage());
+                }
             }
             return null;
         }