X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FConfigParams.java;h=8351374d60fe0e73bb5ca2fbfa2ea01cbd5a3f52;hb=d0f46920468c8e4b67c68bd9058572b2d10d75f1;hp=86ce3113fab53e9f66d64db0fa4d793fd08fc010;hpb=d796a8de8b208ca24bb57aebfc689f8be8bc2c7b;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java index 86ce3113fa..8351374d60 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java @@ -7,19 +7,14 @@ */ package org.opendaylight.controller.cluster.raft; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import scala.concurrent.duration.FiniteDuration; /** - * Configuration Parameter interface for configuring the Raft consensus system - * - *

- * Any component using this implementation might want to provide an implementation of - * this interface to configure - * - *

- * A default implementation will be used if none is provided. + * Configuration Parameter interface for configuring the Raft consensus system. Any component using this implementation + * might want to provide an implementation of this interface to configure. A default implementation will be used if none + * is provided. * * @author Kamal Rameshan */ @@ -35,11 +30,28 @@ public interface ConfigParams { /** * Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken. + * Disabled when direct threshold is enabled. * * @return the percentage. */ int getSnapshotDataThresholdPercentage(); + /** + * Returns the max size of memory used in the in-memory Raft log before a snapshot should be taken. 0 means that + * direct threshold is disabled and percentage is used instead. + * + * @return maximum journal size (in MiB). + */ + int getSnapshotDataThreshold(); + + /** + * Returns the interval(in seconds) after which a snapshot should be taken during recovery. Negative value means + * do not take snapshots. + * + * @return the interval of recovery snapshot in seconds + */ + int getRecoverySnapshotIntervalSeconds(); + /** * Returns the interval at which a heart beat message should be sent to remote followers. * @@ -54,6 +66,14 @@ public interface ConfigParams { */ FiniteDuration getElectionTimeOutInterval(); + /** + * Returns the number by which a candidate should divide the election timeout it has calculated. This serves + * to speed up retries when elections result in a stalemate. + * + * @return the interval as a FiniteDuration. + */ + long getCandidateElectionTimeoutDivisor(); + /** * Returns the maximum election time variance. The election is scheduled using both the election timeout * and variance. @@ -83,7 +103,6 @@ public interface ConfigParams { */ long getIsolatedCheckIntervalInMillis(); - /** * Returns the multiplication factor to be used to determine the shard election timeout. The election timeout * is determined by multiplying the election timeout factor with the heart beat duration. @@ -92,22 +111,19 @@ public interface ConfigParams { */ long getElectionTimeoutFactor(); - /** * Returns the RaftPolicy used to determine certain Raft behaviors. * * @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy. */ - @Nonnull - RaftPolicy getRaftPolicy(); + @NonNull RaftPolicy getRaftPolicy(); /** * Returns the PeerAddressResolver. * * @return the PeerAddressResolver instance. */ - @Nonnull - PeerAddressResolver getPeerAddressResolver(); + @NonNull PeerAddressResolver getPeerAddressResolver(); /** * Returns the custom RaftPolicy class name. @@ -121,8 +137,7 @@ public interface ConfigParams { * * @return the directory in which to create temp files. */ - @Nonnull - String getTempFileDirectory(); + @NonNull String getTempFileDirectory(); /** * Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in @@ -131,4 +146,12 @@ public interface ConfigParams { * @return the threshold in terms of number of bytes. */ int getFileBackedStreamingThreshold(); + + /** + * Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a + * 'not synced' transition. + * + * @return the threshold in terms of number of journal entries. + */ + long getSyncIndexThreshold(); }