Author: mduerig
Date: Wed Apr 20 10:04:15 2016
New Revision: 1740090

URL: http://svn.apache.org/viewvc?rev=1740090&view=rev
Log:
OAK-3348: Cross gc sessions might introduce references to pre-compacted segments
RIP compaction map

Removed:
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CompactionMap.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/InMemoryCompactionMap.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/PartialCompactionMap.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/PersistedCompactionMap.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionMapTest.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/PartialCompactionMapTest.java
Modified:
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBufferWriter.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStoreGCMonitor.java
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/GCMonitorMBean.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionAndCleanupIT.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/HeavyWriteIT.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionMBean.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentDataStoreBlobGCIT.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionEstimatorTest.java

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
 Wed Apr 20 10:04:15 2016
@@ -70,8 +70,6 @@ public class Compactor {
 
     private final SegmentWriter writer;
 
-    private final PartialCompactionMap map;
-
     /**
      * Filters nodes that will be included in the compaction map, allowing for
      * optimization in case of an offline compaction
@@ -123,7 +121,6 @@ public class Compactor {
     public Compactor(SegmentTracker tracker, Supplier<Boolean> cancel) {
         this.tracker = tracker;
         this.writer = tracker.getWriter();
-        this.map = new InMemoryCompactionMap(tracker);
         this.cloneBinaries = false;
         this.cancel = cancel;
     }
@@ -135,15 +132,7 @@ public class Compactor {
     public Compactor(SegmentTracker tracker, CompactionStrategy 
compactionStrategy, Supplier<Boolean> cancel) {
         this.tracker = tracker;
         this.writer = createSegmentWriter(tracker);
-        if (compactionStrategy.getPersistCompactionMap()) {
-            this.map = new PersistedCompactionMap(tracker);
-        } else {
-            this.map = new InMemoryCompactionMap(tracker);
-        }
         this.cloneBinaries = compactionStrategy.cloneBinaries();
-        if (compactionStrategy.isOfflineCompaction()) {
-            includeInMap = new OfflineCompactionPredicate();
-        }
         this.cancel = cancel;
     }
 
@@ -175,11 +164,6 @@ public class Compactor {
         return compacted;
     }
 
-    public PartialCompactionMap getCompactionMap() {
-        map.compress();
-        return map;
-    }
-
     private class CompactDiff extends ApplyDiff {
         private IOException exception;
 
@@ -240,26 +224,12 @@ public class Compactor {
                 log.trace("childNodeAdded {}/{}", path, name);
             }
 
-            RecordId id = null;
-            if (after instanceof SegmentNodeState) {
-                id = ((SegmentNodeState) after).getRecordId();
-                RecordId compactedId = map.get(id);
-                if (compactedId != null) {
-                    builder.setChildNode(name, new 
SegmentNodeState(compactedId));
-                    return true;
-                }
-            }
-
             progress.onNode();
             try {
                 NodeBuilder child = EMPTY_NODE.builder();
                 boolean success =  new CompactDiff(child, path, 
name).diff(EMPTY_NODE, after);
                 if (success) {
-                    SegmentNodeState state = 
writer.writeNode(child.getNodeState());
-                    builder.setChildNode(name, state);
-                    if (id != null && includeInMap.apply(after)) {
-                        map.put(id, state.getRecordId());
-                    }
+                    builder.setChildNode(name, 
writer.writeNode(child.getNodeState()));
                 }
                 return success;
             } catch (IOException e) {
@@ -275,16 +245,6 @@ public class Compactor {
                 log.trace("childNodeChanged {}/{}", path, name);
             }
 
-            RecordId id = null;
-            if (after instanceof SegmentNodeState) {
-                id = ((SegmentNodeState) after).getRecordId();
-                RecordId compactedId = map.get(id);
-                if (compactedId != null) {
-                    builder.setChildNode(name, new 
SegmentNodeState(compactedId));
-                    return true;
-                }
-            }
-
             if (contentEqualityCheck && before.equals(after)) {
                 return true;
             }
@@ -294,10 +254,7 @@ public class Compactor {
                 NodeBuilder child = builder.getChildNode(name);
                 boolean success = new CompactDiff(child, path, 
name).diff(before, after);
                 if (success) {
-                    RecordId compactedId = 
writer.writeNode(child.getNodeState()).getRecordId();
-                    if (id != null) {
-                        map.put(id, compactedId);
-                    }
+                    writer.writeNode(child.getNodeState()).getRecordId();
                 }
                 return success;
             } catch (IOException e) {
@@ -336,19 +293,11 @@ public class Compactor {
             SegmentBlob sb = (SegmentBlob) blob;
             try {
                 // Check if we've already cloned this specific record
-                RecordId id = sb.getRecordId();
-                RecordId compactedId = map.get(id);
-                if (compactedId != null) {
-                    return new SegmentBlob(compactedId);
-                }
-
                 progress.onBinary();
 
                 // if the blob is inlined or external, just clone it
                 if (sb.isExternal() || sb.length() < Segment.MEDIUM_LIMIT) {
-                    SegmentBlob clone = sb.clone(writer, false);
-                    map.put(id, clone.getRecordId());
-                    return clone;
+                    return sb.clone(writer, false);
                 }
 
                 // alternatively look if the exact same binary has been cloned
@@ -357,7 +306,6 @@ public class Compactor {
                 if (ids != null) {
                     for (RecordId duplicateId : ids) {
                         if (new SegmentBlob(duplicateId).equals(sb)) {
-                            map.put(id, duplicateId);
                             return new SegmentBlob(duplicateId);
                         }
                     }
@@ -367,7 +315,7 @@ public class Compactor {
                 if (deepCheckLargeBinaries) {
                     clone = clone
                             || !tracker.getStore().containsSegment(
-                                    id.getSegmentId());
+                                    sb.getRecordId().getSegmentId());
                     if (!clone) {
                         for (SegmentId bid : 
SegmentBlob.getBulkSegmentIds(sb)) {
                             if (!tracker.getStore().containsSegment(bid)) {
@@ -380,7 +328,6 @@ public class Compactor {
 
                 // if not, clone the large blob and keep track of the result
                 sb = sb.clone(writer, clone);
-                map.put(id, sb.getRecordId());
                 if (ids == null) {
                     ids = newArrayList();
                     binaries.put(key, ids);

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
 Wed Apr 20 10:04:15 2016
@@ -59,11 +59,6 @@ class Record {
         this.offset = offset;
     }
 
-    protected boolean wasCompactedTo(Record after) {
-        CompactionMap map = segmentId.getTracker().getCompactionMap();
-        return map.wasCompactedTo(getRecordId(), after.getRecordId());
-    }
-
     /**
      * Returns the tracker of the segment that contains this record.
      *

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
 Wed Apr 20 10:04:15 2016
@@ -208,11 +208,6 @@ public class SegmentBlob extends Record
     public boolean equals(Object object) {
         if (object == this || fastEquals(this, object)) {
             return true;
-        } else if (object instanceof SegmentBlob) {
-            SegmentBlob that = (SegmentBlob) object;
-            if (this.wasCompactedTo(that) || that.wasCompactedTo(this)) {
-                return true;
-            }
         }
         return object instanceof Blob
                 && AbstractBlob.equal(this, (Blob) object);

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBufferWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBufferWriter.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBufferWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBufferWriter.java
 Wed Apr 20 10:04:15 2016
@@ -227,7 +227,7 @@ public class SegmentBufferWriter impleme
     private void checkGCGen(SegmentId id) {
         try {
             if (isDataSegmentId(id.getLeastSignificantBits())) {
-                if (id.getSegment().getGcGen() < generation && 
!isCompactionMap(id)) {
+                if (id.getSegment().getGcGen() < generation) {
                     LOG.warn("Detected reference from {} to segment {} from a 
previous gc generation.",
                         info(this.segment), info(id.getSegment()), new 
Exception());
                 }
@@ -238,11 +238,6 @@ public class SegmentBufferWriter impleme
         }
     }
 
-    private static boolean isCompactionMap(SegmentId id) {
-        String info = id.getSegment().getSegmentInfo();
-        return info != null && info.contains("cm");
-    }
-
     private static String info(Segment segment) {
         String info = segment.getSegmentId().toString();
         if (isDataSegmentId(segment.getSegmentId().getLeastSignificantBits())) 
{

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
 Wed Apr 20 10:04:15 2016
@@ -437,9 +437,6 @@ public class SegmentNodeState extends Re
         }
 
         SegmentNodeState that = (SegmentNodeState) base;
-        if (that.wasCompactedTo(this)) {
-            return true; // no changes during compaction
-        }
 
         Template beforeTemplate = that.getTemplate();
         RecordId beforeId = that.getRecordId();

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
 Wed Apr 20 10:04:15 2016
@@ -28,7 +28,6 @@ import static java.util.concurrent.TimeU
 import static org.apache.jackrabbit.oak.api.Type.LONG;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.plugins.segment.Record.fastEquals;
-import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.GAIN_THRESHOLD_DEFAULT;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.NO_COMPACTION;
 
 import java.io.Closeable;
@@ -100,7 +99,6 @@ public class SegmentNodeStore implements
                 final int lockWaitTime,
                 int retryCount,
                 boolean forceAfterFail,
-                boolean persistCompactionMap,
                 byte gainThreshold) {
 
             compactionStrategy = new CompactionStrategy(
@@ -121,7 +119,6 @@ public class SegmentNodeStore implements
 
             compactionStrategy.setRetryCount(retryCount);
             compactionStrategy.setForceAfterFail(forceAfterFail);
-            compactionStrategy.setPersistCompactionMap(persistCompactionMap);
             compactionStrategy.setGainThreshold(gainThreshold);
 
             return this;

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
 Wed Apr 20 10:04:15 2016
@@ -29,7 +29,6 @@ import static org.apache.jackrabbit.oak.
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.GAIN_THRESHOLD_DEFAULT;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.MEMORY_THRESHOLD_DEFAULT;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.PAUSE_DEFAULT;
-import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.PERSIST_COMPACTION_MAP_DEFAULT;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.RETRY_COUNT_DEFAULT;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.TIMESTAMP_DEFAULT;
 import static 
org.apache.jackrabbit.oak.spi.blob.osgi.SplitBlobStoreService.ONLY_STANDALONE_TARGET;
@@ -223,14 +222,6 @@ public class SegmentNodeStoreService ext
     public static final String COMPACTION_LOCK_WAIT_TIME = 
"compaction.lockWaitTime";
 
     @Property(
-            boolValue = PERSIST_COMPACTION_MAP_DEFAULT,
-            label = "Persist Compaction Map",
-            description = "When enabled the compaction map would be persisted 
instead of being " +
-                    "held in memory"
-    )
-    public static final String PERSIST_COMPACTION_MAP = "persistCompactionMap";
-
-    @Property(
             boolValue = false,
             label = "Standby Mode",
             description = "Flag indicating that this component will not 
register as a NodeStore but just as a NodeStoreProvider"
@@ -492,7 +483,6 @@ public class SegmentNodeStoreService ext
         int retryCount = toInteger(property(COMPACTION_RETRY_COUNT), 
RETRY_COUNT_DEFAULT);
         boolean forceAfterFail = 
toBoolean(property(COMPACTION_FORCE_AFTER_FAIL), FORCE_AFTER_FAIL_DEFAULT);
         final int lockWaitTime = 
toInteger(property(COMPACTION_LOCK_WAIT_TIME), 
COMPACTION_LOCK_WAIT_TIME_DEFAULT);
-        boolean persistCompactionMap = 
toBoolean(property(PERSIST_COMPACTION_MAP), PERSIST_COMPACTION_MAP_DEFAULT);
 
         CleanupType cleanupType = getCleanUpType();
         byte memoryThreshold = getMemoryThreshold();
@@ -516,7 +506,6 @@ public class SegmentNodeStoreService ext
 
         compactionStrategy.setRetryCount(retryCount);
         compactionStrategy.setForceAfterFail(forceAfterFail);
-        compactionStrategy.setPersistCompactionMap(persistCompactionMap);
         compactionStrategy.setGainThreshold(gainThreshold);
 
         return compactionStrategy;

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
 Wed Apr 20 10:04:15 2016
@@ -26,7 +26,6 @@ import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
@@ -85,13 +84,6 @@ public class SegmentTracker {
     private final SegmentWriter writer;
 
     /**
-     * Serialized map that contains the link between old record
-     * identifiers and identifiers of the corresponding records
-     * after compaction.
-     */
-    private final AtomicReference<CompactionMap> compactionMap;
-
-    /**
      * Hash table of weak references to segment identifiers that are
      * currently being accessed. The size of the table is always a power
      * of two, which optimizes the {@code refresh()} operation. The table is
@@ -128,8 +120,6 @@ public class SegmentTracker {
         }
 
         this.store = store;
-        this.compactionMap = new AtomicReference<CompactionMap>(
-                CompactionMap.EMPTY);
         this.writer = new SegmentWriter(store, version,
                             new SegmentBufferWriterPool(store, version, 
"sys"));
         StringCache c;
@@ -256,15 +246,6 @@ public class SegmentTracker {
         segmentCache.put(id, segment, segment.size());
     }
 
-    public void setCompactionMap(PartialCompactionMap map) {
-        compactionMap.set(compactionMap.get().cons(map));
-    }
-
-    @Nonnull
-    public CompactionMap getCompactionMap() {
-        return compactionMap.get();
-    }
-
     int getGcGen() {
         if (store instanceof FileStore) {
             return ((FileStore) store).getGcGen();

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
 Wed Apr 20 10:04:15 2016
@@ -742,8 +742,8 @@ public class SegmentWriter {
         //        split compaction map into 1) id based equality and 2) cache 
(like string and template) for nodes
         private RecordId writeNode(NodeState state) throws IOException {
             if (state instanceof SegmentNodeState) {
-                SegmentNodeState sns = uncompact((SegmentNodeState) state);
-                if (sns != state || hasSegment(sns)) {
+                SegmentNodeState sns = ((SegmentNodeState) state);
+                if (hasSegment(sns)) {
                     if (!isOldGen(sns.getRecordId())) {
                         return sns.getRecordId();
                     }
@@ -757,8 +757,8 @@ public class SegmentWriter {
                 after = (ModifiedNodeState) state;
                 NodeState base = after.getBaseState();
                 if (base instanceof SegmentNodeState) {
-                    SegmentNodeState sns = uncompact((SegmentNodeState) base);
-                    if (sns != base || hasSegment(sns)) {
+                    SegmentNodeState sns = ((SegmentNodeState) base);
+                    if (hasSegment(sns)) {
                         if (!isOldGen(sns.getRecordId())) {
                             before = sns;
                             beforeTemplate = before.getTemplate();
@@ -853,23 +853,6 @@ public class SegmentWriter {
                 && (getTracker().isTracking(((Record) 
property).getRecordId().getSegmentId()));
         }
 
-        /**
-         * If the given node was compacted, return the compacted node, 
otherwise
-         * return the passed node. This is to avoid pointing to old nodes, if 
they
-         * have been compacted.
-         *
-         * @param state the node
-         * @return the compacted node (if it was compacted)
-         */
-        private SegmentNodeState uncompact(SegmentNodeState state) {
-            RecordId id = 
store.getTracker().getCompactionMap().get(state.getRecordId());
-            if (id != null) {
-                return new SegmentNodeState(id);
-            } else {
-                return state;
-            }
-        }
-
         private boolean isOldGen(RecordId id) {
             int thatGen = id.getSegment().getGcGen();
             int thisGen = writer.getGeneration();

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
 Wed Apr 20 10:04:15 2016
@@ -77,8 +77,6 @@ public abstract class CompactionStrategy
 
     public static final byte MEMORY_THRESHOLD_DEFAULT = 5;
 
-    public static final boolean PERSIST_COMPACTION_MAP_DEFAULT = true;
-
     public static final byte GAIN_THRESHOLD_DEFAULT = 10;
 
     /**
@@ -119,8 +117,6 @@ public abstract class CompactionStrategy
 
     private byte memoryThreshold = MEMORY_THRESHOLD_DEFAULT;
 
-    private boolean persistedCompactionMap = PERSIST_COMPACTION_MAP_DEFAULT;
-
     private int retryCount = RETRY_COUNT_DEFAULT;
 
     private boolean forceAfterFail = FORCE_AFTER_FAIL_DEFAULT;
@@ -132,12 +128,6 @@ public abstract class CompactionStrategy
      */
     private byte gainThreshold = GAIN_THRESHOLD_DEFAULT;
 
-    /**
-     * Flag that allows turning on an optimized version of the compaction
-     * process in the case of offline compaction
-     */
-    private boolean offlineCompaction = false;
-
     protected CompactionStrategy(boolean paused,
             boolean cloneBinaries, @Nonnull CleanupType cleanupType, long 
olderThan, byte memoryThreshold) {
         checkArgument(olderThan >= 0);
@@ -208,11 +198,9 @@ public abstract class CompactionStrategy
                 ", cleanupType=" + cleanupType +
                 ", olderThan=" + olderThan +
                 ", memoryThreshold=" + memoryThreshold +
-                ", persistedCompactionMap=" + persistedCompactionMap +
                 ", retryCount=" + retryCount +
                 ", forceAfterFail=" + forceAfterFail +
                 ", compactionStart=" + compactionStart +
-                ", offlineCompaction=" + offlineCompaction +
                 '}';
     }
 
@@ -228,14 +216,6 @@ public abstract class CompactionStrategy
         this.memoryThreshold = memoryThreshold;
     }
 
-    public boolean getPersistCompactionMap() {
-        return persistedCompactionMap;
-    }
-
-    public void setPersistCompactionMap(boolean persist) {
-        persistedCompactionMap = persist;
-    }
-
     /**
      * Get whether or not to force compact concurrent commits on top of already
      * compacted commits after the maximum number of retries has been reached.
@@ -294,14 +274,6 @@ public abstract class CompactionStrategy
 
     public abstract boolean compacted(@Nonnull Callable<Boolean> setHead) 
throws Exception;
 
-    public boolean isOfflineCompaction() {
-        return offlineCompaction;
-    }
-
-    public void setOfflineCompaction(boolean offlineCompaction) {
-        this.offlineCompaction = offlineCompaction;
-    }
-
     /**
      * Check if the approximate repository size is getting too big compared 
with
      * the available space on disk.

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
 Wed Apr 20 10:04:15 2016
@@ -100,14 +100,13 @@ class CompactionGainEstimate implements
      * Returns a percentage estimate (scale 0-100) for how much disk space
      * running compaction (and cleanup) could potentially release.
      *
-     * @param offset  number of bytes to offset the reachable size with
      * @return percentage of disk space that could be freed with compaction
      */
-    public long estimateCompactionGain(long offset) {
+    public long estimateCompactionGain() {
         if (totalSize == 0) {
             return 0;
         }
-        return 100 * (totalSize - reachableSize - offset) / totalSize;
+        return 100 * (totalSize - reachableSize) / totalSize;
     }
 
     public long getTotalSize() {

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
 Wed Apr 20 10:04:15 2016
@@ -31,7 +31,6 @@ import static java.util.concurrent.TimeU
 import static java.util.concurrent.TimeUnit.MINUTES;
 import static org.apache.jackrabbit.oak.commons.IOUtils.humanReadableByteCount;
 import static 
org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
-import static org.apache.jackrabbit.oak.plugins.segment.CompactionMap.sum;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.NO_COMPACTION;
 
 import java.io.Closeable;
@@ -63,9 +62,7 @@ import com.google.common.base.Stopwatch;
 import com.google.common.base.Supplier;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob;
-import org.apache.jackrabbit.oak.plugins.segment.CompactionMap;
 import org.apache.jackrabbit.oak.plugins.segment.Compactor;
-import org.apache.jackrabbit.oak.plugins.segment.PersistedCompactionMap;
 import org.apache.jackrabbit.oak.plugins.segment.RecordId;
 import org.apache.jackrabbit.oak.plugins.segment.Segment;
 import 
org.apache.jackrabbit.oak.plugins.segment.SegmentGraph.SegmentGraphVisitor;
@@ -555,10 +552,7 @@ public class FileStore implements Segmen
 
         Runtime runtime = Runtime.getRuntime();
         long avail = runtime.totalMemory() - runtime.freeMemory();
-        long[] weights = tracker.getCompactionMap().getEstimatedWeights();
-        long delta = weights.length > 0
-            ? weights[0]
-            : 0;
+        long delta = 0;
         long needed = delta * compactionStrategy.getMemoryThreshold();
         if (needed >= avail) {
             gcMonitor.skipped(
@@ -578,10 +572,6 @@ public class FileStore implements Segmen
         compactionStrategy.setCompactionStart(System.currentTimeMillis());
         boolean compacted = false;
 
-        long offset = compactionStrategy.getPersistCompactionMap()
-            ? sum(tracker.getCompactionMap().getRecordCounts()) * 
PersistedCompactionMap.BYTES_PER_ENTRY
-            : 0;
-
         byte gainThreshold = compactionStrategy.getGainThreshold();
         boolean runCompaction = true;
         if (gainThreshold <= 0) {
@@ -598,7 +588,7 @@ public class FileStore implements Segmen
                 return false;
             }
 
-            long gain = estimate.estimateCompactionGain(offset);
+            long gain = estimate.estimateCompactionGain();
             runCompaction = gain >= gainThreshold;
             if (runCompaction) {
                 gcMonitor.info(
@@ -917,19 +907,15 @@ public class FileStore implements Segmen
             toRemove.addLast(file);
         }
 
-        CompactionMap cm = tracker.getCompactionMap();
-        cm.remove(cleanedIds);
         long finalSize = size();
         approximateSize.set(finalSize);
         stats.reclaimed(initialSize - finalSize);
         gcMonitor.cleaned(initialSize - finalSize, finalSize);
         gcMonitor.info("TarMK GC #{}: cleanup completed in {} ({} ms). Post 
cleanup size is {} ({} bytes)" +
-                " and space reclaimed {} ({} bytes). Compaction map 
weight/depth is {}/{} ({} bytes/{}).",
+                " and space reclaimed {} ({} bytes).",
                 gcCount, watch, watch.elapsed(MILLISECONDS),
                 humanReadableByteCount(finalSize), finalSize,
-                humanReadableByteCount(initialSize - finalSize), initialSize - 
finalSize,
-                humanReadableByteCount(sum(cm.getEstimatedWeights())), 
cm.getDepth(),
-                sum(cm.getEstimatedWeights()), cm.getDepth());
+                humanReadableByteCount(initialSize - finalSize), initialSize - 
finalSize);
         return toRemove;
     }
 
@@ -1485,11 +1471,8 @@ public class FileStore implements Segmen
             // needs to be called inside the commitSemaphore as doing otherwise
             // might result in mixed segments. See OAK-2192.
             if (setHead(before, after)) {
-                tracker.setCompactionMap(compactor.getCompactionMap());
-
-                CompactionMap cm = tracker.getCompactionMap();
-                gcMonitor.compacted(cm.getSegmentCounts(), 
cm.getRecordCounts(), cm.getEstimatedWeights());
                 tracker.clearSegmentIdTables(compactionStrategy);
+                gcMonitor.compacted(new long[0], new long[0], new long[0]);
                 return true;
             } else {
                 return false;

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStoreGCMonitor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStoreGCMonitor.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStoreGCMonitor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStoreGCMonitor.java
 Wed Apr 20 10:04:15 2016
@@ -21,7 +21,6 @@ package org.apache.jackrabbit.oak.plugin
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static java.text.DateFormat.getDateTimeInstance;
-import static org.apache.jackrabbit.oak.commons.IOUtils.humanReadableByteCount;
 import static org.apache.jackrabbit.stats.TimeSeriesStatsUtil.asCompositeData;
 import static org.slf4j.helpers.MessageFormatter.arrayFormat;
 
@@ -54,9 +53,6 @@ public class FileStoreGCMonitor extends
     private final Clock clock;
 
     private long lastCompaction;
-    private long[] segmentCounts = new long[0];
-    private long[] recordCounts = new long[0];
-    private long[] compactionMapWeights = new long[0];
     private long lastCleanup;
     private String lastError;
     private String status = "NA";
@@ -103,9 +99,6 @@ public class FileStoreGCMonitor extends
     @Override
     public void compacted(long[] segmentCounts, long[] recordCounts, long[] 
compactionMapWeights) {
         lastCompaction = clock.getTime();
-        this.segmentCounts = segmentCounts;
-        this.recordCounts = recordCounts;
-        this.compactionMapWeights = compactionMapWeights;
     }
 
     @Override
@@ -147,23 +140,6 @@ public class FileStoreGCMonitor extends
         return status;
     }
 
-    @Override
-    public String getCompactionMapStats() {
-        StringBuilder sb = new StringBuilder();
-        String sep = "";
-        for (int k = 0; k < segmentCounts.length; k++) {
-            sb.append(sep).append('[')
-                .append("Estimated Weight: ")
-                
.append(humanReadableByteCount(compactionMapWeights[k])).append(", ")
-                .append("Segments: ")
-                .append(segmentCounts[k]).append(", ")
-                .append("Records: ")
-                .append(recordCounts[k]).append(']');
-            sep = ", ";
-        }
-        return sb.toString();
-    }
-
     @Nonnull
     @Override
     public CompositeData getRepositorySize() {

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/GCMonitorMBean.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/GCMonitorMBean.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/GCMonitorMBean.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/GCMonitorMBean.java
 Wed Apr 20 10:04:15 2016
@@ -55,12 +55,6 @@ public interface GCMonitorMBean {
     String getStatus();
 
     /**
-     * Statistics about the compaction map.
-     */
-    @Nonnull
-    String getCompactionMapStats();
-
-    /**
      * @return  time series of the repository size
      */
     @Nonnull

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionAndCleanupIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionAndCleanupIT.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionAndCleanupIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompactionAndCleanupIT.java
 Wed Apr 20 10:04:15 2016
@@ -114,7 +114,6 @@ public class CompactionAndCleanupIT {
         };
         // Use in memory compaction map as gains asserted later on
         // do not take additional space of the compaction map into 
consideration
-        custom.setPersistCompactionMap(false);
         fileStore.setCompactionStrategy(custom);
 
         // 1a. Create a bunch of data
@@ -203,77 +202,6 @@ public class CompactionAndCleanupIT {
         }
     }
 
-    @Test
-    public void noCleanupOnCompactionMap() throws Exception {
-        // 2MB data, 5MB blob
-        final int blobSize = 5 * 1024 * 1024;
-        final int dataNodes = 10000;
-
-        FileStore fileStore = 
FileStore.builder(getFileStoreFolder()).withMaxFileSize(1).build();
-        final SegmentNodeStore nodeStore = 
SegmentNodeStore.builder(fileStore).build();
-        CompactionStrategy custom = new CompactionStrategy(false, false,
-                CLEAN_OLD, TimeUnit.HOURS.toMillis(1), (byte) 0) {
-            @Override
-            public boolean compacted(@Nonnull Callable<Boolean> setHead)
-                    throws Exception {
-                return nodeStore.locked(setHead);
-            }
-        };
-        fileStore.setCompactionStrategy(custom);
-
-        // 1a. Create a bunch of data
-        NodeBuilder extra = nodeStore.getRoot().builder();
-        NodeBuilder content = extra.child("content");
-        for (int i = 0; i < dataNodes; i++) {
-            NodeBuilder c = content.child("c" + i);
-            for (int j = 0; j < 1000; j++) {
-                c.setProperty("p" + i, "v" + i);
-            }
-        }
-        nodeStore.merge(extra, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-
-        final long dataSize = fileStore.size();
-        log.debug("File store dataSize {}", byteCountToDisplaySize(dataSize));
-
-        try {
-            // 1. Create a property with 5 MB blob
-            NodeBuilder builder = nodeStore.getRoot().builder();
-            builder.setProperty("a1", createBlob(nodeStore, blobSize));
-            builder.setProperty("b", "foo");
-            nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-
-            // 2. Now remove the property
-            builder = nodeStore.getRoot().builder();
-            builder.removeProperty("a1");
-            nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-
-            // 3. Compact
-            fileStore.maybeCompact(false);
-
-            // 4. Add some more property to flush the current TarWriter
-            builder = nodeStore.getRoot().builder();
-            builder.setProperty("a2", createBlob(nodeStore, blobSize));
-            nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-
-            // There should be no SNFE when running cleanup as compaction map 
segments
-            // should be pinned and thus not collected
-            fileStore.maybeCompact(false);
-            fileStore.cleanup();
-
-            // refresh the ts ref, to simulate a long wait time
-            custom.setOlderThan(0);
-            TimeUnit.MILLISECONDS.sleep(5);
-
-            boolean needsCompaction = true;
-            for (int i = 0; i < 3 && needsCompaction; i++) {
-                needsCompaction = fileStore.maybeCompact(false);
-                fileStore.cleanup();
-            }
-        } finally {
-            fileStore.close();
-        }
-    }
-
     private static void assertSize(String info, long size, long lower,
             long upper) {
         log.debug("File Store {} size {}, expected in interval [{},{}]", info,
@@ -603,7 +531,6 @@ public class CompactionAndCleanupIT {
                 }
             };
             // CLEAN_ALL and persisted compaction map results in SNFE in 
compaction map segments
-            strategy.setPersistCompactionMap(false);
             fileStore.setCompactionStrategy(strategy);
 
             // Add a property

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/HeavyWriteIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/HeavyWriteIT.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/HeavyWriteIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/HeavyWriteIT.java
 Wed Apr 20 10:04:15 2016
@@ -27,7 +27,6 @@ import static org.junit.Assume.assumeTru
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
-import java.util.List;
 import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -35,7 +34,6 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.annotation.Nonnull;
 
-import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.commons.FixturesHelper;
@@ -50,15 +48,10 @@ import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 
-@RunWith(Parameterized.class)
 public class HeavyWriteIT {
     private static final Set<Fixture> FIXTURES = FixturesHelper.getFixtures();
 
-    private final boolean usePersistedMap;
-
     @Rule
     public TemporaryFolder folder = new TemporaryFolder();
 
@@ -66,15 +59,6 @@ public class HeavyWriteIT {
         return folder.getRoot();
     }
 
-    @Parameterized.Parameters(name="usePersistedMap: {0}")
-    public static List<Boolean[]> fixtures() {
-        return ImmutableList.of(new Boolean[] {true}, new Boolean[] {false});
-    }
-
-    public HeavyWriteIT(boolean usePersistedMap) {
-        this.usePersistedMap = usePersistedMap;
-    }
-
     @BeforeClass
     public static void checkFixtures() {
         assumeTrue(!travis());  // FIXME OAK-2375. Often fails on Travis
@@ -92,7 +76,6 @@ public class HeavyWriteIT {
                 return nodeStore.locked(setHead);
             }
         };
-        custom.setPersistCompactionMap(usePersistedMap);
         store.setCompactionStrategy(custom);
 
         int writes = 100;

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionIT.java
 Wed Apr 20 10:04:15 2016
@@ -33,7 +33,6 @@ import static java.lang.System.getProper
 import static java.util.concurrent.TimeUnit.MINUTES;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
-import static org.apache.jackrabbit.oak.plugins.segment.CompactionMap.sum;
 import static 
org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.CleanupType.CLEAN_OLD;
 import static org.junit.Assume.assumeTrue;
 import static org.slf4j.helpers.MessageFormatter.arrayFormat;
@@ -238,7 +237,6 @@ public class SegmentCompactionIT {
                 CompactionStrategy.MEMORY_THRESHOLD_DEFAULT, lockWaitTime,
                 CompactionStrategy.RETRY_COUNT_DEFAULT,
                 CompactionStrategy.FORCE_AFTER_FAIL_DEFAULT,
-                PERSIST_COMPACTION_MAP,
                 CompactionStrategy.GAIN_THRESHOLD_DEFAULT);
         nodeStore = nodeStoreBuilder.build();
 
@@ -978,11 +976,6 @@ public class SegmentCompactionIT {
         }
 
         @Override
-        public boolean getPersistCompactionMap() {
-            return compactionStrategy.getPersistCompactionMap();
-        }
-
-        @Override
         public int getReaderCount() {
             return readers.size();
         }
@@ -1002,30 +995,6 @@ public class SegmentCompactionIT {
             return fileStoreSize;
         }
 
-        private CompactionMap getCompactionMap() {
-            return fileStore.getTracker().getCompactionMap();
-        }
-
-        @Override
-        public long getCompactionMapWeight() {
-            return sum(getCompactionMap().getEstimatedWeights());
-        }
-
-        @Override
-        public long getSegmentCount() {
-            return sum(getCompactionMap().getSegmentCounts());
-        }
-
-        @Override
-        public long getRecordCount() {
-            return sum(getCompactionMap().getRecordCounts());
-        }
-
-        @Override
-        public int getCompactionMapDepth() {
-             return getCompactionMap().getDepth();
-        }
-
         @Override
         public String getLastError() {
             return lastError;

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionMBean.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionMBean.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionMBean.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentCompactionMBean.java
 Wed Apr 20 10:04:15 2016
@@ -250,12 +250,6 @@ public interface SegmentCompactionMBean
     boolean getRootReference();
 
     /**
-     * Determine whether the compaction map is persisted or in memory
-     * @return  {@code true} if persisted, {@code false} otherwise
-     */
-    boolean getPersistCompactionMap();
-
-    /**
      * @return  actual number of concurrent readers
      */
     int getReaderCount();
@@ -276,26 +270,6 @@ public interface SegmentCompactionMBean
     long getFileStoreSize();
 
     /**
-     * @return  current weight of the compaction map
-     */
-    long getCompactionMapWeight();
-
-    /**
-     * @return  number of record referenced by the keys in this map.
-     */
-    long getRecordCount();
-
-    /**
-     * @return  number of segments referenced by the keys in this map.
-     */
-    long getSegmentCount();
-
-    /**
-     * @return  current depth of the compaction map
-     */
-    int getCompactionMapDepth();
-
-    /**
      * @return  last error
      */
     String getLastError();

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentDataStoreBlobGCIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentDataStoreBlobGCIT.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentDataStoreBlobGCIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentDataStoreBlobGCIT.java
 Wed Apr 20 10:04:15 2016
@@ -72,20 +72,15 @@ import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Tests for SegmentNodeStore DataStore GC
  */
-@RunWith(Parameterized.class)
 public class SegmentDataStoreBlobGCIT {
     private static final Logger log = 
LoggerFactory.getLogger(SegmentDataStoreBlobGCIT.class);
 
-    private final boolean usePersistedMap;
-
     SegmentNodeStore nodeStore;
     FileStore store;
     DataStoreBlobStore blobStore;
@@ -98,15 +93,6 @@ public class SegmentDataStoreBlobGCIT {
     public static void assumptions() {
         assumeTrue(getFixtures().contains(SEGMENT_MK));
     }
-    
-    @Parameterized.Parameters
-    public static List<Boolean[]> fixtures() {
-        return ImmutableList.of(new Boolean[] {true}, new Boolean[] {false});
-    }
-
-    public SegmentDataStoreBlobGCIT(boolean usePersistedMap) {
-        this.usePersistedMap = usePersistedMap;
-    }
 
     protected SegmentNodeStore getNodeStore(BlobStore blobStore) throws 
IOException {
         if (nodeStore == null) {
@@ -122,7 +108,6 @@ public class SegmentDataStoreBlobGCIT {
                         return setHead.call();
                     }
                 };
-            compactionStrategy.setPersistCompactionMap(usePersistedMap);
             store.setCompactionStrategy(compactionStrategy);
             nodeStore = SegmentNodeStore.builder(store).build();
         }

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionEstimatorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionEstimatorTest.java?rev=1740090&r1=1740089&r2=1740090&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionEstimatorTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionEstimatorTest.java
 Wed Apr 20 10:04:15 2016
@@ -80,7 +80,7 @@ public class CompactionEstimatorTest {
         try {
             // should be at 66%
             
assertTrue(fileStore.estimateCompactionGain(Suppliers.ofInstance(false))
-                    .estimateCompactionGain(0) > 60);
+                    .estimateCompactionGain() > 60);
         } finally {
             fileStore.close();
         }


Reply via email to