This is an automated email from the ASF dual-hosted git repository. baedke pushed a commit to branch issue/oak-11284 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/issue/oak-11284 by this push: new e933f78c30 OAK-11284: Greedy Reuse of cluster IDs may lead to synchronous LastRevRecovery executions slowing down startup e933f78c30 is described below commit e933f78c30ea2417ae0f881fe8a090e7bafbf8a0 Author: Manfred Baedke <manfred.bae...@gmail.com> AuthorDate: Tue Nov 26 15:27:35 2024 +0100 OAK-11284: Greedy Reuse of cluster IDs may lead to synchronous LastRevRecovery executions slowing down startup Introduced the system variable oak.syncRecoveryTimeout to limit the duration of a self recovery at startup. --- .../jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java index 9c3a516c63..3dc0ed94e4 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java @@ -45,6 +45,7 @@ import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.guava.common.collect.Sets; import org.apache.jackrabbit.oak.commons.TimeDurationFormatter; +import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier; import org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlor; import org.apache.jackrabbit.oak.plugins.document.cache.CacheInvalidationStats; import org.apache.jackrabbit.oak.plugins.document.util.MapFactory; @@ -79,6 +80,8 @@ public class LastRevRecoveryAgent { private final Consumer<Integer> afterRecovery; + private static final SystemPropertySupplier<Long> SYNC_RECEVERY_TIMEOUT = SystemPropertySupplier.create("oak.syncRecoveryTimeout", Long.MAX_VALUE); + private static final long LOGINTERVALMS = TimeUnit.MINUTES.toMillis(1); // OAK-9535 : create (flush) a pseudo branch commit journal entry as soon as @@ -268,6 +271,10 @@ public class LastRevRecoveryAgent { if (nodeInfo != null && nodeInfo.isActive()) { deadline = nodeInfo.getLeaseEndTime() - ClusterNodeInfo.DEFAULT_LEASE_FAILURE_MARGIN_MILLIS; } + long now = System.currentTimeMillis(); + if (Long.MAX_VALUE - SYNC_RECEVERY_TIMEOUT.get() > now) { + deadline = Math.min(deadline, now + SYNC_RECEVERY_TIMEOUT.get()); + } } NodeDocument rootDoc = Utils.getRootDocument(store);