Class MongoVersionGCSupport
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.VersionGCSupport
-
- org.apache.jackrabbit.oak.plugins.document.mongo.MongoVersionGCSupport
-
public class MongoVersionGCSupport extends VersionGCSupport
Mongo specific version of VersionGCSupport which uses mongo queries to fetch required NodeDocumentsVersion collection involves looking into old record and mostly unmodified documents. In such case read from secondaries are preferred
-
-
Constructor Summary
Constructors Constructor Description MongoVersionGCSupport(MongoDocumentStore store)
MongoVersionGCSupport(MongoDocumentStore store, boolean fullGcBinEnabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SplitDocumentCleanUp
createCleanUp(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp, VersionGarbageCollector.VersionGCStats stats)
long
getDeletedOnceCount()
Optional<NodeDocument>
getDocument(String id, List<String> fields)
Retrieves a document with the given id from the MongoDB collection.FullGcNodeBin
getFullGCBin()
Iterable<NodeDocument>
getModifiedDocs(long fromModified, long toModified, int limit, @NotNull String fromId, @NotNull Set<String> includedPathPrefixes, @NotNull Set<String> excludedPathPrefixes)
Returns documents that have aNodeDocument.MODIFIED_IN_SECS
value within the given range and are greater than given @Document.ID
.long
getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
Retrieve the time of the oldest document marked as 'deletedOnce'.Optional<NodeDocument>
getOldestModifiedDoc(Clock clock)
Retrieve the time of the oldest modified document.CloseableIterable<NodeDocument>
getPossiblyDeletedDocs(long fromModified, long toModified)
Returns documents that have aNodeDocument.MODIFIED_IN_SECS
value within the given range and theNodeDocument.DELETED
set totrue
.protected Iterable<NodeDocument>
identifyGarbage(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp)
-
Methods inherited from class org.apache.jackrabbit.oak.plugins.document.VersionGCSupport
getDocumentStore, isDefaultNoBranchSplitNewerThan
-
-
-
-
Constructor Detail
-
MongoVersionGCSupport
public MongoVersionGCSupport(MongoDocumentStore store)
-
MongoVersionGCSupport
public MongoVersionGCSupport(MongoDocumentStore store, boolean fullGcBinEnabled)
-
-
Method Detail
-
getPossiblyDeletedDocs
public CloseableIterable<NodeDocument> getPossiblyDeletedDocs(long fromModified, long toModified)
Description copied from class:VersionGCSupport
Returns documents that have aNodeDocument.MODIFIED_IN_SECS
value within the given range and theNodeDocument.DELETED
set totrue
. The two passed modified timestamps are in milliseconds since the epoch and the implementation will convert them to seconds at the granularity of theNodeDocument.MODIFIED_IN_SECS
field and then perform the comparison.- Overrides:
getPossiblyDeletedDocs
in classVersionGCSupport
- Parameters:
fromModified
- the lower bound modified timestamp (inclusive)toModified
- the upper bound modified timestamp (exclusive)- Returns:
- matching documents.
-
getModifiedDocs
public Iterable<NodeDocument> getModifiedDocs(long fromModified, long toModified, int limit, @NotNull @NotNull String fromId, @NotNull @NotNull Set<String> includedPathPrefixes, @NotNull @NotNull Set<String> excludedPathPrefixes)
Returns documents that have aNodeDocument.MODIFIED_IN_SECS
value within the given range and are greater than given @Document.ID
.The two passed modified timestamps are in milliseconds since the epoch and the implementation will convert them to seconds at the granularity of the
NodeDocument.MODIFIED_IN_SECS
field and then perform the comparison.- Overrides:
getModifiedDocs
in classVersionGCSupport
- Parameters:
fromModified
- the lower bound modified timestamp in millis (inclusive)toModified
- the upper bound modified timestamp in millis (exclusive)limit
- the limit of documents to returnfromId
- the lower boundDocument.ID
(exclusive)- Returns:
- matching documents.
-
getDocument
public Optional<NodeDocument> getDocument(String id, List<String> fields)
Retrieves a document with the given id from the MongoDB collection. If a list of fields is provided, only these fields are included in the returned document.- Overrides:
getDocument
in classVersionGCSupport
- Parameters:
id
- the id of the document to retrievefields
- the list of fields to include in the returned document. If null or empty, all fields are returned.- Returns:
- an Optional that contains the requested NodeDocument if it exists, or an empty Optional if it does not.
-
getDeletedOnceCount
public long getDeletedOnceCount()
- Overrides:
getDeletedOnceCount
in classVersionGCSupport
-
createCleanUp
protected SplitDocumentCleanUp createCleanUp(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp, VersionGarbageCollector.VersionGCStats stats)
- Overrides:
createCleanUp
in classVersionGCSupport
-
identifyGarbage
protected Iterable<NodeDocument> identifyGarbage(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp)
- Overrides:
identifyGarbage
in classVersionGCSupport
-
getOldestDeletedOnceTimestamp
public long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
Description copied from class:VersionGCSupport
Retrieve the time of the oldest document marked as 'deletedOnce'.- Overrides:
getOldestDeletedOnceTimestamp
in classVersionGCSupport
precisionMs
- the exact time may vary by given precision- Returns:
- the timestamp of the oldest document marked with 'deletecOnce', module given prevision. If no such document exists, returns the max time inspected (close to current time).
-
getOldestModifiedDoc
public Optional<NodeDocument> getOldestModifiedDoc(Clock clock)
Retrieve the time of the oldest modified document.- Overrides:
getOldestModifiedDoc
in classVersionGCSupport
- Parameters:
clock
- System Clock to measure time in accuracy of millis- Returns:
- the timestamp of the oldest modified document.
-
getFullGCBin
public FullGcNodeBin getFullGCBin()
- Overrides:
getFullGCBin
in classVersionGCSupport
-
-