Class DefaultConfigParamsImpl
java.lang.Object
org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl
- All Implemented Interfaces:
ConfigParams
Default implementation of the ConfigParams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final scala.concurrent.duration.FiniteDuration
The interval at which a heart beat message will be sent to the remote RaftActor.Fields inherited from interface org.opendaylight.controller.cluster.raft.ConfigParams
MEGABYTE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the number by which a candidate should divide the election timeout it has calculated.Returns the custom RaftPolicy class name.long
Returns the multiplication factor to be used to determine the shard election timeout.scala.concurrent.duration.FiniteDuration
Returns the interval after which a new election should be triggered if no leader is available.int
Returns the maximum election time variance.int
Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in memory to buffering to a file.scala.concurrent.duration.FiniteDuration
Returns the interval at which a heart beat message should be sent to remote followers.long
Returns the interval in which the leader needs to check if its isolated.int
Returns the maximum number of journal log entries to batch on recovery before applying.Returns the PeerAddressResolver.Returns the RaftPolicy used to determine certain Raft behaviors.int
Returns the interval(in seconds) after which a snapshot should be taken during recovery.long
Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.int
Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.int
Returns the max size of memory used in the in-memory Raft log before a snapshot should be taken.int
Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.long
Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.Returns the directory in which to create temp files.void
setCandidateElectionTimeoutDivisor
(long candidateElectionTimeoutDivisor) void
setCustomRaftPolicyImplementationClass
(String customRaftPolicyImplementationClass) void
setElectionTimeoutFactor
(long electionTimeoutFactor) void
setFileBackedStreamingThreshold
(int fileBackedStreamingThreshold) void
setHeartBeatInterval
(scala.concurrent.duration.FiniteDuration heartBeatInterval) void
setIsolatedLeaderCheckInterval
(scala.concurrent.duration.FiniteDuration isolatedLeaderCheckInterval) void
setJournalRecoveryLogBatchSize
(int journalRecoveryLogBatchSize) void
setPeerAddressResolver
(@NonNull PeerAddressResolver peerAddressResolver) void
setRecoverySnapshotIntervalSeconds
(int recoverySnapshotInterval) void
setSnapshotBatchCount
(long snapshotBatchCount) void
setSnapshotChunkSize
(int snapshotChunkSize) void
setSnapshotDataThreshold
(int snapshotDataThreshold) void
setSnapshotDataThresholdPercentage
(int snapshotDataThresholdPercentage) void
setSyncIndexThreshold
(long syncIndexThreshold) void
setTempFileDirectory
(String tempFileDirectory)
-
Field Details
-
HEART_BEAT_INTERVAL
public static final scala.concurrent.duration.FiniteDuration HEART_BEAT_INTERVALThe interval at which a heart beat message will be sent to the remote RaftActor.Since this is set to 100 milliseconds the Election timeout should be at least 200 milliseconds
-
-
Constructor Details
-
DefaultConfigParamsImpl
public DefaultConfigParamsImpl()
-
-
Method Details
-
setHeartBeatInterval
public void setHeartBeatInterval(scala.concurrent.duration.FiniteDuration heartBeatInterval) -
setSnapshotBatchCount
public void setSnapshotBatchCount(long snapshotBatchCount) -
setRecoverySnapshotIntervalSeconds
public void setRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval) -
setSnapshotDataThresholdPercentage
public void setSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage) -
setSnapshotDataThreshold
public void setSnapshotDataThreshold(int snapshotDataThreshold) -
setSnapshotChunkSize
public void setSnapshotChunkSize(int snapshotChunkSize) -
setJournalRecoveryLogBatchSize
public void setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize) -
setIsolatedLeaderCheckInterval
public void setIsolatedLeaderCheckInterval(scala.concurrent.duration.FiniteDuration isolatedLeaderCheckInterval) -
setElectionTimeoutFactor
public void setElectionTimeoutFactor(long electionTimeoutFactor) -
setCandidateElectionTimeoutDivisor
public void setCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor) -
setTempFileDirectory
-
setFileBackedStreamingThreshold
public void setFileBackedStreamingThreshold(int fileBackedStreamingThreshold) -
setCustomRaftPolicyImplementationClass
-
getCustomRaftPolicyImplementationClass
Description copied from interface:ConfigParams
Returns the custom RaftPolicy class name.- Specified by:
getCustomRaftPolicyImplementationClass
in interfaceConfigParams
- Returns:
- the RaftPolicy class name or null if none set.
-
getSnapshotBatchCount
public long getSnapshotBatchCount()Description copied from interface:ConfigParams
Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.- Specified by:
getSnapshotBatchCount
in interfaceConfigParams
- Returns:
- the minimum number of entries.
-
getSnapshotDataThresholdPercentage
public int getSnapshotDataThresholdPercentage()Description copied from 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.- Specified by:
getSnapshotDataThresholdPercentage
in interfaceConfigParams
- Returns:
- the percentage.
-
getSnapshotDataThreshold
public int getSnapshotDataThreshold()Description copied from interface:ConfigParams
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.- Specified by:
getSnapshotDataThreshold
in interfaceConfigParams
- Returns:
- maximum journal size (in MiB).
-
getRecoverySnapshotIntervalSeconds
public int getRecoverySnapshotIntervalSeconds()Description copied from interface:ConfigParams
Returns the interval(in seconds) after which a snapshot should be taken during recovery. Negative value means do not take snapshots.- Specified by:
getRecoverySnapshotIntervalSeconds
in interfaceConfigParams
- Returns:
- the interval of recovery snapshot in seconds
-
getHeartBeatInterval
public scala.concurrent.duration.FiniteDuration getHeartBeatInterval()Description copied from interface:ConfigParams
Returns the interval at which a heart beat message should be sent to remote followers.- Specified by:
getHeartBeatInterval
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeOutInterval
public scala.concurrent.duration.FiniteDuration getElectionTimeOutInterval()Description copied from interface:ConfigParams
Returns the interval after which a new election should be triggered if no leader is available.- Specified by:
getElectionTimeOutInterval
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getCandidateElectionTimeoutDivisor
public long getCandidateElectionTimeoutDivisor()Description copied from interface:ConfigParams
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.- Specified by:
getCandidateElectionTimeoutDivisor
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeVariance
public int getElectionTimeVariance()Description copied from interface:ConfigParams
Returns the maximum election time variance. The election is scheduled using both the election timeout and variance.- Specified by:
getElectionTimeVariance
in interfaceConfigParams
- Returns:
- the election time variance.
-
getSnapshotChunkSize
public int getSnapshotChunkSize()Description copied from interface:ConfigParams
Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.- Specified by:
getSnapshotChunkSize
in interfaceConfigParams
- Returns:
- the maximum size (in bytes).
-
getJournalRecoveryLogBatchSize
public int getJournalRecoveryLogBatchSize()Description copied from interface:ConfigParams
Returns the maximum number of journal log entries to batch on recovery before applying.- Specified by:
getJournalRecoveryLogBatchSize
in interfaceConfigParams
- Returns:
- the maximum number of journal log entries.
-
getIsolatedCheckIntervalInMillis
public long getIsolatedCheckIntervalInMillis()Description copied from interface:ConfigParams
Returns the interval in which the leader needs to check if its isolated.- Specified by:
getIsolatedCheckIntervalInMillis
in interfaceConfigParams
- Returns:
- the interval in ms.
-
getElectionTimeoutFactor
public long getElectionTimeoutFactor()Description copied from interface:ConfigParams
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.- Specified by:
getElectionTimeoutFactor
in interfaceConfigParams
- Returns:
- the election timeout factor.
-
getRaftPolicy
Description copied from interface:ConfigParams
Returns the RaftPolicy used to determine certain Raft behaviors.- Specified by:
getRaftPolicy
in interfaceConfigParams
- Returns:
- an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
-
getTempFileDirectory
Description copied from interface:ConfigParams
Returns the directory in which to create temp files.- Specified by:
getTempFileDirectory
in interfaceConfigParams
- Returns:
- the directory in which to create temp files.
-
getFileBackedStreamingThreshold
public int getFileBackedStreamingThreshold()Description copied from interface:ConfigParams
Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in memory to buffering to a file.- Specified by:
getFileBackedStreamingThreshold
in interfaceConfigParams
- Returns:
- the threshold in terms of number of bytes.
-
getPeerAddressResolver
Description copied from interface:ConfigParams
Returns the PeerAddressResolver.- Specified by:
getPeerAddressResolver
in interfaceConfigParams
- Returns:
- the PeerAddressResolver instance.
-
setPeerAddressResolver
-
getSyncIndexThreshold
public long getSyncIndexThreshold()Description copied from interface:ConfigParams
Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.- Specified by:
getSyncIndexThreshold
in interfaceConfigParams
- Returns:
- the threshold in terms of number of journal entries.
-
setSyncIndexThreshold
public void setSyncIndexThreshold(long syncIndexThreshold)
-