Author: mduerig
Date: Tue Jun 27 09:37:45 2017
New Revision: 1800043

URL: http://svn.apache.org/viewvc?rev=1800043&view=rev
Log:
OAK-5790: Chronologically rebase checkpoints on top of each other during 
compaction
Add feature flag for the update limit during compaction instead of hard coding 
it

Modified:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java?rev=1800043&r1=1800042&r2=1800043&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
 Tue Jun 27 09:37:45 2017
@@ -57,6 +57,13 @@ import org.slf4j.LoggerFactory;
 public class OnlineCompactor {
     private static final Logger log = 
LoggerFactory.getLogger(OnlineCompactor.class);
 
+    /**
+     * Number of content updates that need to happen before the updates
+     * are automatically purged to the underlying segments.
+     */
+    static final int UPDATE_LIMIT =
+            Integer.getInteger("compaction.update.limit", 10000);
+
     @Nonnull
     private final SegmentWriter writer;
 
@@ -140,7 +147,7 @@ public class OnlineCompactor {
         private long modCount;
 
         private void updated() throws IOException {
-            if (++modCount % 10000 == 0) {
+            if (++modCount % UPDATE_LIMIT == 0) {
                 RecordId newBaseId = writer.writeNode(builder.getNodeState(), 
null);
                 SegmentNodeState newBase = new SegmentNodeState(reader, 
writer, blobStore, newBaseId);
                 builder = new MemoryNodeBuilder(newBase);

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java?rev=1800043&r1=1800042&r2=1800043&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
 Tue Jun 27 09:37:45 2017
@@ -31,6 +31,7 @@ import static org.apache.commons.io.File
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
 import static 
org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
+import static org.apache.jackrabbit.oak.segment.OnlineCompactor.UPDATE_LIMIT;
 import static 
org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions.defaultGCOptions;
 import static 
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
 import static org.junit.Assert.assertEquals;
@@ -1106,7 +1107,7 @@ public class CompactionAndCleanupIT {
 
             // A final bit of content
             builder = nodeStore.getRoot().builder();
-            for (int k = 0; k < 10000; k++) {
+            for (int k = 0; k < UPDATE_LIMIT; k++) {
                 builder.setChildNode("b-" + k);
             }
             nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);


Reply via email to