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 DurationThe interval at which a heart beat message will be sent to the remote RaftActor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number by which a candidate should divide the election timeout it has calculated.longReturns the multiplication factor to be used to determine the shard election timeout.Returns the interval after which a new election should be triggered if no leader is available.intReturns the maximum election time variance.intReturns the threshold in terms of number of bytes when streaming data before it should switch from storing in memory to buffering to a file.Returns the interval at which a heart beat message should be sent to remote followers.longReturns the interval in which the leader needs to check if its isolated.intReturns the maximum number of journal log entries to batch on recovery before applying.intReturns the maximum size (in bytes) for the snapshot chunk sent from a Leader.Returns the PeerAddressResolver.Returns the preferredCompressionType.Returns the RaftPolicy used to determine certain Raft behaviors.intReturns the interval(in seconds) after which a snapshot should be taken during recovery.longReturns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.intReturns 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.intReturns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.longReturns 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.voidsetCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor) voidsetElectionTimeoutFactor(long electionTimeoutFactor) voidsetFileBackedStreamingThreshold(int fileBackedStreamingThreshold) voidsetHeartBeatInterval(Duration heartBeatInterval) voidsetIsolatedLeaderCheckInterval(Duration isolatedLeaderCheckInterval) voidsetJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize) voidsetMaximumMessageSliceSize(int maximumMessageSliceSize) voidsetPeerAddressResolver(@NonNull PeerAddressResolver peerAddressResolver) voidsetPreferredCompression(CompressionType preferredFileFormat) voidsetRaftPolicy(RaftPolicy newRaftPolicy) voidsetRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval) voidsetSnapshotBatchCount(long snapshotBatchCount) voidsetSnapshotDataThreshold(int snapshotDataThreshold) voidsetSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage) voidsetSyncIndexThreshold(long syncIndexThreshold) voidsetTempFileDirectory(Path tempFileDirectory)
-
Field Details
-
HEART_BEAT_INTERVAL
The 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
-
setSnapshotBatchCount
public void setSnapshotBatchCount(long snapshotBatchCount) -
setRecoverySnapshotIntervalSeconds
public void setRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval) -
setSnapshotDataThresholdPercentage
public void setSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage) -
setSnapshotDataThreshold
public void setSnapshotDataThreshold(int snapshotDataThreshold) -
setMaximumMessageSliceSize
public void setMaximumMessageSliceSize(int maximumMessageSliceSize) -
setJournalRecoveryLogBatchSize
public void setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize) -
setIsolatedLeaderCheckInterval
-
setElectionTimeoutFactor
public void setElectionTimeoutFactor(long electionTimeoutFactor) -
setCandidateElectionTimeoutDivisor
public void setCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor) -
setTempFileDirectory
-
setFileBackedStreamingThreshold
public void setFileBackedStreamingThreshold(int fileBackedStreamingThreshold) -
setRaftPolicy
-
getSnapshotBatchCount
public long getSnapshotBatchCount()Description copied from interface:ConfigParamsReturns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.- Specified by:
getSnapshotBatchCountin interfaceConfigParams- Returns:
- the minimum number of entries.
-
getSnapshotDataThresholdPercentage
public int getSnapshotDataThresholdPercentage()Description copied from interface:ConfigParamsReturns 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:
getSnapshotDataThresholdPercentagein interfaceConfigParams- Returns:
- the percentage.
-
getSnapshotDataThreshold
public int getSnapshotDataThreshold()Description copied from interface:ConfigParamsReturns 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:
getSnapshotDataThresholdin interfaceConfigParams- Returns:
- maximum journal size (in MiB).
-
getRecoverySnapshotIntervalSeconds
public int getRecoverySnapshotIntervalSeconds()Description copied from interface:ConfigParamsReturns the interval(in seconds) after which a snapshot should be taken during recovery. Negative value means do not take snapshots.- Specified by:
getRecoverySnapshotIntervalSecondsin interfaceConfigParams- Returns:
- the interval of recovery snapshot in seconds
-
getHeartBeatInterval
Description copied from interface:ConfigParamsReturns the interval at which a heart beat message should be sent to remote followers.- Specified by:
getHeartBeatIntervalin interfaceConfigParams- Returns:
- the interval as a
Duration.
-
getElectionTimeOutInterval
Description copied from interface:ConfigParamsReturns the interval after which a new election should be triggered if no leader is available.- Specified by:
getElectionTimeOutIntervalin interfaceConfigParams- Returns:
- the interval as a
Duration.
-
getCandidateElectionTimeoutDivisor
public long getCandidateElectionTimeoutDivisor()Description copied from interface:ConfigParamsReturns 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:
getCandidateElectionTimeoutDivisorin interfaceConfigParams- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeVariance
public int getElectionTimeVariance()Description copied from interface:ConfigParamsReturns the maximum election time variance. The election is scheduled using both the election timeout and variance.- Specified by:
getElectionTimeVariancein interfaceConfigParams- Returns:
- the election time variance.
-
getMaximumMessageSliceSize
public int getMaximumMessageSliceSize()Description copied from interface:ConfigParamsReturns the maximum size (in bytes) for the snapshot chunk sent from a Leader.- Specified by:
getMaximumMessageSliceSizein interfaceConfigParams- Returns:
- the maximum size (in bytes).
-
getJournalRecoveryLogBatchSize
public int getJournalRecoveryLogBatchSize()Description copied from interface:ConfigParamsReturns the maximum number of journal log entries to batch on recovery before applying.- Specified by:
getJournalRecoveryLogBatchSizein interfaceConfigParams- Returns:
- the maximum number of journal log entries.
-
getIsolatedCheckIntervalInMillis
public long getIsolatedCheckIntervalInMillis()Description copied from interface:ConfigParamsReturns the interval in which the leader needs to check if its isolated.- Specified by:
getIsolatedCheckIntervalInMillisin interfaceConfigParams- Returns:
- the interval in ms.
-
getElectionTimeoutFactor
public long getElectionTimeoutFactor()Description copied from interface:ConfigParamsReturns 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:
getElectionTimeoutFactorin interfaceConfigParams- Returns:
- the election timeout factor.
-
getRaftPolicy
Description copied from interface:ConfigParamsReturns the RaftPolicy used to determine certain Raft behaviors.- Specified by:
getRaftPolicyin interfaceConfigParams- Returns:
- an instance of
RaftPolicy
-
getTempFileDirectory
Description copied from interface:ConfigParamsReturns the directory in which to create temp files.- Specified by:
getTempFileDirectoryin interfaceConfigParams- Returns:
- the directory in which to create temp files.
-
getFileBackedStreamingThreshold
public int getFileBackedStreamingThreshold()Description copied from interface:ConfigParamsReturns 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:
getFileBackedStreamingThresholdin interfaceConfigParams- Returns:
- the threshold in terms of number of bytes.
-
getPeerAddressResolver
Description copied from interface:ConfigParamsReturns the PeerAddressResolver.- Specified by:
getPeerAddressResolverin interfaceConfigParams- Returns:
- the PeerAddressResolver instance.
-
setPeerAddressResolver
-
getSyncIndexThreshold
public long getSyncIndexThreshold()Description copied from interface:ConfigParamsReturns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.- Specified by:
getSyncIndexThresholdin interfaceConfigParams- Returns:
- the threshold in terms of number of journal entries.
-
setSyncIndexThreshold
public void setSyncIndexThreshold(long syncIndexThreshold) -
getPreferredCompression
Description copied from interface:ConfigParamsReturns the preferredCompressionType.- Specified by:
getPreferredCompressionin interfaceConfigParams- Returns:
- the preferred
CompressionType
-
setPreferredCompression
-