Class VersionGCSupport
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.VersionGCSupport
-
- Direct Known Subclasses:
MongoVersionGCSupport
,RDBVersionGCSupport
public class VersionGCSupport extends Object
-
-
Constructor Summary
Constructors Constructor Description VersionGCSupport(DocumentStore store)
-
Method Summary
All Methods Static 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 DocumentStore.@NotNull DocumentStore
getDocumentStore()
Returns the underlying document store.FullGcNodeBin
getFullGCBin()
Iterable<NodeDocument>
getModifiedDocs(long fromModified, long toModified, int limit, @NotNull String fromId, @NotNull Set<String> includePaths, @NotNull Set<String> excludePaths)
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 oldest modified document.Iterable<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)
protected static boolean
isDefaultNoBranchSplitNewerThan(NodeDocument doc, RevisionVector sweepRevs)
Returnstrue
if the given document is of typeNodeDocument.SplitDocType.DEFAULT_NO_BRANCH
and the most recent change on the document is newer than thesweepRevs
.
-
-
-
Constructor Detail
-
VersionGCSupport
public VersionGCSupport(DocumentStore store)
-
-
Method Detail
-
getPossiblyDeletedDocs
public Iterable<NodeDocument> getPossiblyDeletedDocs(long fromModified, long toModified)
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.- 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> includePaths, @NotNull @NotNull Set<String> excludePaths)
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.- Parameters:
fromModified
- the lower bound modified timestamp (inclusive)toModified
- the upper bound modified timestamp (exclusive)limit
- the limit of documents to returnfromId
- the lower boundDocument.ID
- Returns:
- matching documents.
-
getDocumentStore
@NotNull public @NotNull DocumentStore getDocumentStore()
Returns the underlying document store.- Returns:
- the underlying document store.
-
createCleanUp
protected SplitDocumentCleanUp createCleanUp(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp, VersionGarbageCollector.VersionGCStats stats)
-
identifyGarbage
protected Iterable<NodeDocument> identifyGarbage(Set<NodeDocument.SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp)
-
getOldestDeletedOnceTimestamp
public long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
Retrieve the time of the oldest document marked as 'deletedOnce'.- Parameters:
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 oldest modified document.- Returns:
- the oldest modified document.
-
getDocument
public Optional<NodeDocument> getDocument(String id, List<String> fields)
Retrieves a document with the given id from the DocumentStore. If a list of fields is provided, only these fields are included in the returned document.- 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() throws UnsupportedOperationException
- Throws:
UnsupportedOperationException
-
isDefaultNoBranchSplitNewerThan
protected static boolean isDefaultNoBranchSplitNewerThan(NodeDocument doc, RevisionVector sweepRevs)
Returnstrue
if the given document is of typeNodeDocument.SplitDocType.DEFAULT_NO_BRANCH
and the most recent change on the document is newer than thesweepRevs
.- Parameters:
doc
- the document to check.sweepRevs
- the current sweep revisions.- Returns:
true
if the document is aNodeDocument.SplitDocType.DEFAULT_NO_BRANCH
and it is newer thansweepRevs
;false
otherwise.
-
getFullGCBin
public FullGcNodeBin getFullGCBin()
-
-