Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ public static void garbageReport(DocumentNodeStore dns) {

public static VersionGarbageCollector createVersionGC(final DocumentNodeStore nodeStore, final VersionGCSupport gcSupport,
boolean isFullGCDryRun, final DocumentNodeStoreBuilder<?> builder) {
return new VersionGarbageCollector(nodeStore, gcSupport, isFullGCEnabled(builder), isFullGCDryRun,
VersionGarbageCollector gc = new VersionGarbageCollector(nodeStore, gcSupport, isFullGCEnabled(builder), isFullGCDryRun,
isEmbeddedVerificationEnabled(builder), builder.getFullGCMode(), builder.getFullGCDelayFactor(),
builder.getFullGCBatchSize(), builder.getFullGCProgressSize(), builder.getFullGcMaxAgeMillis(),
builder.getFullGCGeneration());
gc.setFullGCPaths(builder.getFullGCIncludePaths(), builder.getFullGCExcludePaths());
return gc;
}

public static DocumentNodeState readNode(DocumentNodeStore documentNodeStore, Path path, RevisionVector rootRevision) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,29 +411,27 @@ private VersionGarbageCollector bootstrapVGC(RevisionsOptions options, Closer cl
version);
System.exit(1);
}
if (options.isEmbeddedVerificationEnabled()) {
builder.setEmbeddedVerificationEnabled(true);
}
builder.setEmbeddedVerificationEnabled(options.isEmbeddedVerificationEnabled());
// set it read-only before the DocumentNodeStore is created
// this prevents the DocumentNodeStore from writing a new
// clusterId to the clusterNodes and nodes collections
builder.setReadOnlyMode();
useMemoryBlobStore(builder);
// create a version GC that operates on a read-only DocumentNodeStore
// and a GC support with a writable DocumentStore
System.out.println("DryRun is enabled : " + options.isDryRun());
System.out.println("EmbeddedVerification is enabled : " + options.isEmbeddedVerificationEnabled());
VersionGarbageCollector gc = createVersionGC(builder.build(), gcSupport, options.isDryRun(), builder);
System.out.println("DryRun is enabled : " + gc.isFullGCDryRun());
System.out.println("EmbeddedVerification is enabled : " + gc.isEmbeddedVerificationEnabled());
System.out.println("ResetFullGC is enabled : " + options.isResetFullGC());
System.out.println("Compaction is enabled : " + options.doCompaction());
System.out.println("IncludePaths are : " + Arrays.toString(options.getIncludePaths()));
System.out.println("ExcludePaths are : " + Arrays.toString(options.getExcludePaths()));
System.out.println("FullGcMode is : " + options.getFullGcMode());
System.out.println("FullGcDelayFactory is : " + options.getFullGcDelayFactor());
System.out.println("FullGcBatchSize is : " + options.getFullGcBatchSize());
System.out.println("FullGcProgressSize is : " + options.getFullGcProgressSize());
System.out.println("IncludePaths are : " + gc.getFullGCIncludePaths());
System.out.println("ExcludePaths are : " + gc.getFullGCExcludePaths());
System.out.println("FullGcMode is : " + VersionGarbageCollector.getFullGcMode());
System.out.println("FullGcDelayFactor is : " + gc.getFullGcDelayFactor());
System.out.println("FullGcBatchSize is : " + gc.getFullGcBatchSize());
System.out.println("FullGcProgressSize is : " + gc.getFullGcProgressSize());
System.out.println("FullGcMaxAgeInSecs is : " + options.getFullGcMaxAge());
System.out.println("FullGcMaxAgeMillis is : " + builder.getFullGcMaxAgeMillis());
VersionGarbageCollector gc = createVersionGC(builder.build(), gcSupport, options.isDryRun(), builder);
System.out.println("FullGcMaxAgeMillis is : " + gc.getFullGcMaxAgeInMillis());

VersionGCOptions gcOptions = gc.getOptions();
gcOptions = gcOptions.withDelayFactor(options.getDelay());
Expand Down Expand Up @@ -654,6 +652,7 @@ private void collectDocument(RevisionsOptions options, Closer closer, String pat
DocumentStore documentStore = builder.getDocumentStore();
builder.setReadOnlyMode();
useMemoryBlobStore(builder);
builder.setEmbeddedVerificationEnabled(options.isEmbeddedVerificationEnabled());
DocumentNodeStore documentNodeStore = builder.build();

VersionGarbageCollector gc = bootstrapVGC(options, closer, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ public void fullGC() {
assertTrue(output.contains("ResetFullGC is enabled : false\n"));
assertTrue(output.contains("Compaction is enabled : false\n"));
assertTrue(output.contains("starting gc collect\n"));
assertTrue(output.contains("IncludePaths are : [/]\n"));
assertTrue(output.contains("IncludePaths are : []\n"));
assertTrue(output.contains("ExcludePaths are : []\n"));
assertTrue(output.contains("FullGcMode is : 0\n"));
assertTrue(output.contains("FullGcDelayFactory is : 2.0\n"));
assertTrue(output.contains("FullGcMode is : NONE\n"));
assertTrue(output.contains("FullGcDelayFactor is : 2.0\n"));
assertTrue(output.contains("FullGcBatchSize is : 1000\n"));
assertTrue(output.contains("FullGcProgressSize is : 10000\n"));
assertTrue(output.contains("FullGcMaxAgeInSecs is : 86400\n"));
Expand All @@ -220,7 +220,7 @@ public void fullGCWithDelayFactor() {
ns.dispose();

String output = captureSystemOut(new RevisionsCmd("fullGC", "--fullGcDelayFactor", "2.5", "--entireRepo"));
assertTrue(output.contains("FullGcDelayFactory is : 2.5\n"));
assertTrue(output.contains("FullGcDelayFactor is : 2.5\n"));
assertTrue(output.contains("starting gc collect"));
}

Expand Down Expand Up @@ -251,7 +251,19 @@ public void fullGCWithMode() {
assertTrue(output.contains("ResetFullGC is enabled : false"));
assertTrue(output.contains("Compaction is enabled : false"));
assertTrue(output.contains("starting gc collect"));
assertTrue(output.contains("FullGcMode is : 3"));
assertTrue(output.contains("FullGcMode is : GAP_ORPHANS_EMPTYPROPS"));
}

@Test
public void fullGCWithModeAllOrphans() {
ns.dispose();

String output = captureSystemOut(new RevisionsCmd("fullGC", "--entireRepo", "--fullGcMode", "4"));
assertTrue(output.contains("DryRun is enabled : true"));
assertTrue(output.contains("ResetFullGC is enabled : false"));
assertTrue(output.contains("Compaction is enabled : false"));
assertTrue(output.contains("starting gc collect"));
assertTrue(output.contains("FullGcMode is : ALL_ORPHANS_EMPTYPROPS"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Ultimately the goal is to clean up all possible garbage. After hardening these modes
* might no longer be supported.
*/
enum FullGCMode {
public enum FullGCMode {
/**
* no full GC is done at all
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,45 @@ public class VersionGarbageCollector {
private static FullGCMode fullGcMode = GAP_ORPHANS_EMPTYPROPS;
private final long fullGcGen;

static FullGCMode getFullGcMode() {
public static FullGCMode getFullGcMode() {
return fullGcMode;
}

public boolean isFullGCEnabled() {
return fullGCEnabled;
}

public boolean isFullGCDryRun() {
return isFullGCDryRun;
}

public boolean isEmbeddedVerificationEnabled() {
return embeddedVerification;
}

public double getFullGcDelayFactor() {
return fullGCDelayFactor;
}

public long getFullGcMaxAgeInMillis() {
return fullGcMaxAgeInMillis;
}

public int getFullGcBatchSize() {
return fullGCBatchSize;
}

public int getFullGcProgressSize() {
return fullGCProgressSize;
}

public Set<String> getFullGCIncludePaths() {
return fullGCIncludePaths;
}

public Set<String> getFullGCExcludePaths() {
return fullGCExcludePaths;
}

/**
* Set the full GC mode to be used according to the provided configuration value.
Expand Down
Loading