Author: mduerig
Date: Fri Aug 11 15:01:28 2017
New Revision: 1804792

URL: http://svn.apache.org/viewvc?rev=1804792&view=rev
Log:
OAK-6399: Re-establish full offline compaction functionality
Rename OnlineCompactor to Compactor

Added:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Compactor.java
      - copied, changed from r1804791, 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
Removed:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java
Modified:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreBackupImpl.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreRestoreImpl.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/OnlineCompactorTest.java

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreBackupImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreBackupImpl.java?rev=1804792&r1=1804791&r2=1804792&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreBackupImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreBackupImpl.java
 Fri Aug 11 15:01:28 2017
@@ -29,8 +29,8 @@ import javax.annotation.Nonnull;
 import com.google.common.base.Stopwatch;
 import com.google.common.base.Suppliers;
 import org.apache.jackrabbit.oak.backup.FileStoreBackup;
+import org.apache.jackrabbit.oak.segment.Compactor;
 import org.apache.jackrabbit.oak.segment.DefaultSegmentWriter;
-import org.apache.jackrabbit.oak.segment.OnlineCompactor;
 import org.apache.jackrabbit.oak.segment.Revisions;
 import org.apache.jackrabbit.oak.segment.SegmentBufferWriter;
 import org.apache.jackrabbit.oak.segment.SegmentNodeState;
@@ -84,7 +84,7 @@ public class FileStoreBackupImpl impleme
                     new WriterCacheManager.Default(),
                     bufferWriter
             );
-            OnlineCompactor compactor = new OnlineCompactor(
+            Compactor compactor = new Compactor(
                     backup.getReader(),
                     writer,
                     backup.getBlobStore(),

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreRestoreImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreRestoreImpl.java?rev=1804792&r1=1804791&r2=1804792&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreRestoreImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/FileStoreRestoreImpl.java
 Fri Aug 11 15:01:28 2017
@@ -29,7 +29,7 @@ import com.google.common.base.Stopwatch;
 import com.google.common.base.Suppliers;
 import org.apache.jackrabbit.oak.backup.FileStoreRestore;
 import org.apache.jackrabbit.oak.segment.DefaultSegmentWriter;
-import org.apache.jackrabbit.oak.segment.OnlineCompactor;
+import org.apache.jackrabbit.oak.segment.Compactor;
 import org.apache.jackrabbit.oak.segment.SegmentBufferWriter;
 import org.apache.jackrabbit.oak.segment.SegmentNodeState;
 import org.apache.jackrabbit.oak.segment.SegmentWriter;
@@ -79,7 +79,7 @@ public class FileStoreRestoreImpl implem
                     bufferWriter
             );
             SegmentGCOptions gcOptions = defaultGCOptions().setOffline();
-            OnlineCompactor compactor = new OnlineCompactor(
+            Compactor compactor = new Compactor(
                     store.getReader(),
                     writer,
                     store.getBlobStore(),

Copied: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Compactor.java
 (from r1804791, 
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/Compactor.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Compactor.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/OnlineCompactor.java&r1=1804791&r2=1804792&rev=1804792&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/Compactor.java
 Fri Aug 11 15:01:28 2017
@@ -54,7 +54,7 @@ import org.apache.jackrabbit.oak.spi.sta
  * A node can either be compacted on its own or alternatively the difference 
between
  * two nodes can be compacted on top of an already compacted node.
  */
-public class OnlineCompactor {
+public class Compactor {
 
     /**
      * Number of content updates that need to happen before the updates
@@ -87,7 +87,7 @@ public class OnlineCompactor {
      * @param compactionMonitor   notification call back for each compacted 
nodes,
      *                            properties, and binaries
      */
-    public OnlineCompactor(
+    public Compactor(
             @Nonnull SegmentReader reader,
             @Nonnull SegmentWriter writer,
             @Nullable BlobStore blobStore,

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1804792&r1=1804791&r2=1804792&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
 Fri Aug 11 15:01:28 2017
@@ -73,7 +73,7 @@ import com.google.common.base.Predicate;
 import com.google.common.base.Stopwatch;
 import com.google.common.base.Supplier;
 import com.google.common.io.Closer;
-import org.apache.jackrabbit.oak.segment.OnlineCompactor;
+import org.apache.jackrabbit.oak.segment.Compactor;
 import org.apache.jackrabbit.oak.segment.RecordId;
 import org.apache.jackrabbit.oak.segment.Segment;
 import org.apache.jackrabbit.oak.segment.SegmentId;
@@ -731,7 +731,7 @@ public class FileStore extends AbstractF
                         .withGeneration(newGeneration)
                         .withoutWriterPool()
                         .build(FileStore.this);
-                OnlineCompactor compactor = new OnlineCompactor(
+                Compactor compactor = new Compactor(
                         segmentReader, writer, getBlobStore(), cancel, 
compactionMonitor);
 
                 SegmentNodeState after = compact(base, before, compactor, 
writer);
@@ -838,7 +838,7 @@ public class FileStore extends AbstractF
         private SegmentNodeState compact(
                 @Nullable SegmentNodeState base,
                 @Nonnull SegmentNodeState uncompacted,
-                @Nonnull OnlineCompactor compactor,
+                @Nonnull Compactor compactor,
                 @Nonnull SegmentWriter writer)
         throws IOException {
             // Collect a chronologically ordered list of roots for the base 
and the uncompacted
@@ -875,7 +875,7 @@ public class FileStore extends AbstractF
         private LinkedHashMap<String, NodeState> compact(
                 @Nonnull LinkedHashMap<String, NodeState> baseRoots,
                 @Nonnull LinkedHashMap<String, NodeState> uncompactedRoots,
-                @Nonnull OnlineCompactor compactor)
+                @Nonnull Compactor compactor)
         throws IOException {
             NodeState onto = baseRoots.get("root");
             NodeState previous = onto;
@@ -936,7 +936,7 @@ public class FileStore extends AbstractF
 
         private SegmentNodeState forceCompact(
                 @Nonnull final SegmentNodeState base,
-                @Nonnull final OnlineCompactor compactor,
+                @Nonnull final Compactor compactor,
                 @Nonnull SegmentWriter writer)
         throws InterruptedException {
             RecordId compactedId = revisions.setHead(new Function<RecordId, 
RecordId>() {

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=1804792&r1=1804791&r2=1804792&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
 Fri Aug 11 15:01:28 2017
@@ -32,7 +32,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.Compactor.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;
@@ -371,7 +371,7 @@ public class CompactionAndCleanupIT {
     }
 
     @Test
-    @Ignore("OAK-6399") // FIXME OAK-6399: this test fails because the content 
based binary deduplication feature is missing in OnlineCompactor
+    @Ignore("OAK-6399") // FIXME OAK-6399: this test fails because the content 
based binary deduplication feature is missing in Compactor
     public void offlineCompactionBinC1() throws Exception {
         SegmentGCOptions gcOptions = defaultGCOptions().setOffline()
                 .withBinaryDeduplication();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/OnlineCompactorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/OnlineCompactorTest.java?rev=1804792&r1=1804791&r2=1804792&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/OnlineCompactorTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/OnlineCompactorTest.java
 Fri Aug 11 15:01:28 2017
@@ -59,7 +59,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
-// FIXME OAK-6522: Implement unit tests for OnlineCompactor
+// FIXME OAK-6522: Implement unit tests for Compactor
 public class OnlineCompactorTest {
     @Rule
     public TemporaryFolder folder = new TemporaryFolder(new File("target"));
@@ -81,7 +81,7 @@ public class OnlineCompactorTest {
 
     @Test
     public void testCompact() throws Exception {
-        OnlineCompactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), null);
+        Compactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), null);
         addTestContent(nodeStore);
 
         SegmentNodeState uncompacted = (SegmentNodeState) nodeStore.getRoot();
@@ -102,8 +102,8 @@ public class OnlineCompactorTest {
 
     @Test
     public void testExceedUpdateLimit() throws Exception {
-        OnlineCompactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), null);
-        addNodes(nodeStore, OnlineCompactor.UPDATE_LIMIT * 2 + 1);
+        Compactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), null);
+        addNodes(nodeStore, Compactor.UPDATE_LIMIT * 2 + 1);
 
         SegmentNodeState uncompacted = (SegmentNodeState) nodeStore.getRoot();
         SegmentNodeState compacted = compactor.compact(uncompacted);
@@ -115,7 +115,7 @@ public class OnlineCompactorTest {
 
     @Test
     public void testCancel() throws IOException, CommitFailedException {
-        OnlineCompactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(true), null);
+        Compactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(true), null);
         addTestContent(nodeStore);
         NodeBuilder builder = nodeStore.getRoot().builder();
         builder.setChildNode("cancel").setProperty("cancel", "cancel");
@@ -126,20 +126,20 @@ public class OnlineCompactorTest {
 
     @Test(expected = IOException.class)
     public void testIOException() throws IOException, CommitFailedException {
-        OnlineCompactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), "IOException");
+        Compactor compactor = createCompactor(fileStore, 
Suppliers.ofInstance(false), "IOException");
         addTestContent(nodeStore);
         compactor.compact(nodeStore.getRoot());
     }
 
     @Nonnull
-    private static OnlineCompactor createCompactor(FileStore fileStore, 
Supplier<Boolean> cancel, String failOnName) {
+    private static Compactor createCompactor(FileStore fileStore, 
Supplier<Boolean> cancel, String failOnName) {
         SegmentWriter writer = defaultSegmentWriterBuilder("c")
                 .withGeneration(newGCGeneration(1, 1, true))
                 .build(fileStore);
         if (failOnName != null) {
             writer = new FailingSegmentWriter(writer, failOnName);
         }
-        return new OnlineCompactor(fileStore.getReader(), writer, 
fileStore.getBlobStore(), cancel, GCNodeWriteMonitor.EMPTY);
+        return new Compactor(fileStore.getReader(), writer, 
fileStore.getBlobStore(), cancel, GCNodeWriteMonitor.EMPTY);
     }
 
     private static void addNodes(SegmentNodeStore nodeStore, int count)


Reply via email to