Joscorbe commented on a change in pull request #274:
URL: https://github.com/apache/jackrabbit-oak/pull/274#discussion_r581913853
##########
File path:
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreMBeanImpl.java
##########
@@ -264,4 +268,28 @@ public String cleanIndividualCache(String name) {
return "ERROR: Invalid cache name received.";
}
}
+
+ @Override
+ public String createCheckpoint(String revision, long lifetime, boolean
force) {
+ Revision rev = Revision.fromString(revision);
+ long oldestTimestamp = nodeStore.getClock().getTime() -
revisionGCMaxAgeMillis;
+ Revision oldestCheckpoint =
nodeStore.getCheckpoints().getOldestRevisionToKeep();
+ if (oldestCheckpoint != null) {
+ oldestTimestamp = Math.min(oldestTimestamp,
oldestCheckpoint.getTimestamp());
+ }
+ if (force || oldestTimestamp < rev.getTimestamp()) {
+ Map<String, String> info = new HashMap<>();
+ info.put(COMPOSITE_INFO + "created",
Long.toString(rev.getTimestamp()));
+ info.put(COMPOSITE_INFO + "expires",
Long.toString(Utils.sum(rev.getTimestamp() + lifetime)));
+
+ String cp = nodeStore.getCheckpoints().create(lifetime, info,
rev).toString();
+ log.info("Created checkpoint [{}] with lifetime {} for Revision
{}", cp, lifetime, revision);
+ return cp;
Review comment:
Something like:
return String.format("Created checkpoint [{}] with lifetime {} for Revision
{}", cp, lifetime, revision);
But changing this would mean at least 2 tests would need to be adjusted:
createCheckpointForceWithRevisionTooOld()
createCheckpointBeforeExistingCheckpoint()
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]