rishabhdaim commented on code in PR #1278: URL: https://github.com/apache/jackrabbit-oak/pull/1278#discussion_r1466302954
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java: ########## @@ -229,6 +234,12 @@ static RecoverLockState fromString(String state) { /** OAK-3399 : max number of times we're doing a 1sec retry loop just before declaring lease failure **/ private static final int MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE = 5; + /** OAK-10622 : seconds to prevent reuse of clusterId if it crashed and thus required a recover */ + private static final int DEFAULT_REUSE_AFTER_RECOVERY_SECS = SystemPropertySupplier.create("oak.documentMK.reuseDelayAfterRecoverySecs", -1) + .loggingTo(LOG).validateWith(value -> value >= -1) + .formatSetMessage((name, value) -> String.format("Reuse delay after recovery set to (secs): %ss (using system property %s)", name, value)).get(); + public static final int DEFAULT_REUSE_AFTER_RECOVERY_MILLIS = 1000 * DEFAULT_REUSE_AFTER_RECOVERY_SECS; Review Comment: Scope could be reduced to `default` since it is only used in `ClusterNodeInfoTest`. ########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java: ########## @@ -615,6 +650,18 @@ private static Map.Entry<ClusterNodeInfo, Long> createInstance(DocumentStore sto // if we get here the cluster node entry is inactive. if recovery // was needed, then it was successful + if (reuseAfterRecoveryMillis > 0) { + Long lastRecoveryTime = (Long) doc.get(RECOVERY_TIME_KEY); Review Comment: We are setting `RECOVERY_TIME_KEY` as null in many places and this could lead to an NPE in case it is null here. I would suggest using default value in place of null when we are setting `RECOVERY_TIME_KEY` or doing a null check here before casting to `Long`. -- 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: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org