public class MarkSweepGarbageCollector extends java.lang.Object implements BlobGarbageCollector
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BATCH_COUNT |
static java.lang.String |
DELIM |
static org.slf4j.Logger |
LOG |
static java.lang.String |
TEMP_DIR |
| Constructor and Description |
|---|
MarkSweepGarbageCollector(BlobReferenceRetriever marker,
org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore,
java.util.concurrent.Executor executor,
long maxLastModifiedInterval,
@Nullable java.lang.String repositoryId,
@Nullable org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard whiteboard,
@Nullable org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider)
Instantiates a new blob garbage collector.
|
MarkSweepGarbageCollector(BlobReferenceRetriever marker,
org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore,
java.util.concurrent.Executor executor,
java.lang.String root,
int batchCount,
long maxLastModifiedInterval,
boolean checkConsistencyAfterGc,
@Nullable java.lang.String repositoryId,
@Nullable org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard whiteboard,
@Nullable org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider)
Creates an instance of MarkSweepGarbageCollector
|
MarkSweepGarbageCollector(BlobReferenceRetriever marker,
org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore,
java.util.concurrent.Executor executor,
java.lang.String root,
int batchCount,
long maxLastModifiedInterval,
@Nullable java.lang.String repositoryId) |
| Modifier and Type | Method and Description |
|---|---|
long |
checkConsistency()
Checks for the DataStore consistency and reports the number of missing blobs still referenced.
|
void |
collectGarbage(boolean markOnly)
Marks garbage blobs from the passed node store instance.
|
void |
collectGarbage(boolean markOnly,
boolean forceBlobRetrieve)
Marks garbage blobs from the passed node store instance.
|
OperationsStatsMBean |
getConsistencyOperationStats()
Returns consistency operation statistics
|
OperationsStatsMBean |
getOperationStats()
Returns operation statistics
|
java.util.List<GarbageCollectionRepoStats> |
getStats()
Returns the stats related to GC for all repos
|
protected void |
iterateNodeTree(GarbageCollectorFileState fs,
boolean logPath)
Iterates the complete node tree and collect all blob references
|
protected void |
mark(GarbageCollectorFileState fs)
Mark phase of the GC.
|
protected void |
markAndSweep(boolean markOnly,
boolean forceBlobRetrieve)
Mark and sweep.
|
void |
setTraceOutput(boolean trace) |
protected long |
sweep(GarbageCollectorFileState fs,
long markStart,
boolean forceBlobRetrieve)
Sweep phase of gc candidate deletion.
|
public static final org.slf4j.Logger LOG
public static final java.lang.String TEMP_DIR
public static final int DEFAULT_BATCH_COUNT
public static final java.lang.String DELIM
public MarkSweepGarbageCollector(BlobReferenceRetriever marker, org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore, java.util.concurrent.Executor executor, java.lang.String root, int batchCount, long maxLastModifiedInterval, boolean checkConsistencyAfterGc, @Nullable @Nullable java.lang.String repositoryId, @Nullable @Nullable org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard whiteboard, @Nullable @Nullable org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider) throws java.io.IOException
marker - BlobReferenceRetriever instanced used to fetch refereed blob entriesblobStore - the blob store instanceexecutor - executorroot - the root absolute path of directory under which temporary
files would be createdbatchCount - batch sized used for saving intermediate statemaxLastModifiedInterval - lastModifiedTime in millis. Only files with time
less than this time would be considered for GCrepositoryId - unique repository id for this nodewhiteboard - whiteboard instancestatisticsProvider - statistics provider instancejava.io.IOExceptionpublic MarkSweepGarbageCollector(BlobReferenceRetriever marker, org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore, java.util.concurrent.Executor executor, java.lang.String root, int batchCount, long maxLastModifiedInterval, @Nullable @Nullable java.lang.String repositoryId) throws java.io.IOException
java.io.IOExceptionpublic MarkSweepGarbageCollector(BlobReferenceRetriever marker, org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore blobStore, java.util.concurrent.Executor executor, long maxLastModifiedInterval, @Nullable @Nullable java.lang.String repositoryId, @Nullable @Nullable org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard whiteboard, @Nullable @Nullable org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider) throws java.io.IOException
java.io.IOExceptionpublic void collectGarbage(boolean markOnly)
throws java.lang.Exception
BlobGarbageCollectorcollectGarbage in interface BlobGarbageCollectormarkOnly - whether to only mark references and not sweep in the mark and sweep operation.java.lang.Exception - the exceptionpublic void collectGarbage(boolean markOnly,
boolean forceBlobRetrieve)
throws java.lang.Exception
BlobGarbageCollectorcollectGarbage in interface BlobGarbageCollectormarkOnly - whether to only mark references and not sweep in the mark and sweep operation.forceBlobRetrieve - whether to force retrieve of blob ids from datastorejava.lang.Exceptionpublic java.util.List<GarbageCollectionRepoStats> getStats() throws java.lang.Exception
getStats in interface BlobGarbageCollectorjava.lang.Exceptionpublic OperationsStatsMBean getOperationStats()
BlobGarbageCollectorgetOperationStats in interface BlobGarbageCollectorpublic OperationsStatsMBean getConsistencyOperationStats()
BlobGarbageCollectorgetConsistencyOperationStats in interface BlobGarbageCollectorprotected void markAndSweep(boolean markOnly,
boolean forceBlobRetrieve)
throws java.lang.Exception
markOnly - whether to mark onlyforceBlobRetrieve - force retrieve blob idsjava.lang.Exception - the exceptionprotected void mark(GarbageCollectorFileState fs) throws java.io.IOException, DataStoreException
fs - the garbage collector file statejava.io.IOExceptionDataStoreExceptionprotected long sweep(GarbageCollectorFileState fs, long markStart, boolean forceBlobRetrieve) throws java.lang.Exception
Performs the following steps depending upon the type of the blob store refer
SharedDataStore.Type:
fs - the garbage collector file statemarkStart - the start time of mark to take as reference for deletionforceBlobRetrieve - java.lang.Exception - the exceptionprotected void iterateNodeTree(GarbageCollectorFileState fs, boolean logPath) throws java.io.IOException
fs - the garbage collector file statelogPath - whether to log path in the file or notjava.io.IOExceptionpublic long checkConsistency()
throws java.lang.Exception
checkConsistency in interface BlobGarbageCollectorjava.lang.Exceptionpublic void setTraceOutput(boolean trace)
Copyright © 2012–2022 The Apache Software Foundation. All rights reserved.