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 ju...@apache.org on 2014/06/16 07:44:40 UTC
svn commit: r1602800 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Author: jukka
Date: Mon Jun 16 05:44:40 2014
New Revision: 1602800
URL: http://svn.apache.org/r1602800
Log:
OAK-1804: TarMK compaction
Drop the write number -based compaction threshold as it is troublesome
with large repositories where the size of the repository could exceed
the number of tar files used by compaction.
Move JVM gc to the point where it's most needed, i.e. just before cleanup.
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1602800&r1=1602799&r2=1602800&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java Mon Jun 16 05:44:40 2014
@@ -131,12 +131,6 @@ public class FileStore implements Segmen
private final AtomicBoolean compactNeeded = new AtomicBoolean(false);
/**
- * The number of new files created at which a compaction should be
- * triggered.
- */
- private int compactThreshold = 10;
-
- /**
* List of old tar file generations that are waiting to be removed.
*/
private final LinkedList<File> toBeRemoved = newLinkedList();
@@ -364,6 +358,10 @@ public class FileStore implements Segmen
if (cleanup) {
long start = System.nanoTime();
+ // Suggest to the JVM that now would be a good time
+ // to clear stale weak references in the SegmentTracker
+ System.gc();
+
Set<UUID> ids = newHashSet();
for (SegmentId id : tracker.getReferencedSegmentIds()) {
ids.add(new UUID(
@@ -591,9 +589,6 @@ public class FileStore implements Segmen
directory,
String.format(FILE_NAME_FORMAT, writeNumber, "a"));
writer = new TarWriter(writeFile);
- if (writeNumber % compactThreshold == 0) {
- compactNeeded.set(true);
- }
}
} catch (IOException e) {
throw new RuntimeException(e);
@@ -616,7 +611,6 @@ public class FileStore implements Segmen
@Override
public void gc() {
- System.gc();
compactNeeded.set(true);
}