mreutegg commented on code in PR #812:
URL: https://github.com/apache/jackrabbit-oak/pull/812#discussion_r1064807971
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java:
##########
@@ -569,11 +569,14 @@ public boolean containsRevision(@NotNull Revision
revision) {
* committed
* </p>
*
- * @param context the revision context.
+ * @param clusterId the clusterId.
* @param batchSize the batch size to purge uncommitted revisions
+ * @param olderThanLastWrittenRootRevPredicate @{@link
java.util.function.Predicate} to filter revisions older than lastWrittenRootRev
Review Comment:
```suggestion
* @param olderThanLastWrittenRootRevPredicate {@link
java.util.function.Predicate} to filter revisions older than lastWrittenRootRev
```
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##########
@@ -3704,6 +3735,30 @@ private static Supplier<Integer>
getDelay(DocumentNodeStore ns) {
}
}
+ /**
+ * Background unmerged branch commits & collision marker operation.
+ */
+ private static class BackgroundPurgeOperation extends NodeStoreTask {
+
+ BackgroundPurgeOperation(DocumentNodeStore nodeStore, AtomicBoolean
isDisposed) {
+ // run every 60 secs
+ super(nodeStore, isDisposed, Suppliers.ofInstance(60000));
+ }
+
+ @Override
+ protected void execute(@NotNull DocumentNodeStore nodeStore) {
+ final Clock clock = nodeStore.getClock();
+ long now = clock.getTime();
+ LOG.info("BackgroundPurgeOperation.execute: started purging for
non active clusterIds");
Review Comment:
I would not log info messages for periodic operations like these. Change to
debug? `UnmergedBranches.purgeUnmergedBranchCommitAndCollisionMarkers()` will
log a message at info level when something was purged.
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##########
@@ -2931,6 +2946,22 @@ private int backgroundSweep() throws
DocumentStoreException {
return num;
}
+ private void purgeUnmergedBranchCommitAndCollisionMarkers(final
ClusterNodeInfoDocument cluster) {
+ branches.purgeUnmergedBranchCommitAndCollisionMarkers(store,
cluster.getClusterId(), purgeUncommittedRevisions,
+ getOlderThanLastWrittenRootRevPredicate(cluster));
+ }
+
+ /**
+ * Method to create @{@link java.util.function.Predicate} to filter
revisions
+ *
+ * @return @{@link java.util.function.Predicate} to filter revisions older
than lastWrittenRootRev
+ */
+ @NotNull
+ @VisibleForTesting
+ static java.util.function.Predicate<Revision>
getOlderThanLastWrittenRootRevPredicate(final ClusterNodeInfoDocument cluster) {
Review Comment:
I would rather move this as a non-static method to
`ClusterNodeInfoDocument`. Something like
`ClusterNodeInfoDocument.asOlderThanLastWrittenRootRevPredicate()`.
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]