Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAK-11284: Greedy Reuse of cluster IDs may lead to synchronous LastRe… #1877

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
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;
Expand Down Expand Up @@ -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);
mbaedke marked this conversation as resolved.
Show resolved Hide resolved

private static final long LOGINTERVALMS = TimeUnit.MINUTES.toMillis(1);

// OAK-9535 : create (flush) a pseudo branch commit journal entry as soon as
Expand Down Expand Up @@ -268,6 +271,10 @@ public int recover(final Iterable<NodeDocument> suspects,
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());
}
mbaedke marked this conversation as resolved.
Show resolved Hide resolved
}

NodeDocument rootDoc = Utils.getRootDocument(store);
Expand Down