X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDatastoreContext.java;h=2987ea2da4253e8ec84267483443f4447c7aca73;hp=69131a0d1c19a238e0ba57df3786bad3b93caa65;hb=7cb260aeb0738104e3bee8a086de9e2e5f77b7e0;hpb=66e956cbf397a86f1a512396feb7cb87ea602f92 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java index 69131a0d1c..2987ea2da4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java @@ -56,6 +56,7 @@ public class DatastoreContext implements ClientActorConfig { public static final boolean DEFAULT_SNAPSHOT_ON_ROOT_OVERWRITE = false; public static final FileAkkaConfigurationReader DEFAULT_CONFIGURATION_READER = new FileAkkaConfigurationReader(); public static final int DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD_PERCENTAGE = 12; + public static final int DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD = 0; public static final int DEFAULT_SHARD_ELECTION_TIMEOUT_FACTOR = 2; public static final int DEFAULT_SHARD_CANDIDATE_ELECTION_TIMEOUT_DIVISOR = 1; public static final int DEFAULT_TX_CREATION_INITIAL_RATE_LIMIT = 100; @@ -113,6 +114,7 @@ public class DatastoreContext implements ClientActorConfig { setHeartbeatInterval(DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS); setIsolatedLeaderCheckInterval(DEFAULT_ISOLATED_LEADER_CHECK_INTERVAL_IN_MILLIS); setSnapshotDataThresholdPercentage(DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD_PERCENTAGE); + setSnapshotDataThreshold(DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD); setElectionTimeoutFactor(DEFAULT_SHARD_ELECTION_TIMEOUT_FACTOR); setCandidateElectionTimeoutDivisor(DEFAULT_SHARD_CANDIDATE_ELECTION_TIMEOUT_DIVISOR); setSyncIndexThreshold(DEFAULT_SYNC_INDEX_THRESHOLD); @@ -153,6 +155,7 @@ public class DatastoreContext implements ClientActorConfig { setHeartbeatInterval(other.raftConfig.getHeartBeatInterval().toMillis()); setIsolatedLeaderCheckInterval(other.raftConfig.getIsolatedCheckIntervalInMillis()); setSnapshotDataThresholdPercentage(other.raftConfig.getSnapshotDataThresholdPercentage()); + setSnapshotDataThreshold(other.raftConfig.getSnapshotDataThreshold()); setElectionTimeoutFactor(other.raftConfig.getElectionTimeoutFactor()); setCandidateElectionTimeoutDivisor(other.raftConfig.getCandidateElectionTimeoutDivisor()); setCustomRaftPolicyImplementation(other.raftConfig.getCustomRaftPolicyImplementationClass()); @@ -304,6 +307,11 @@ public class DatastoreContext implements ClientActorConfig { raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage); } + private void setSnapshotDataThreshold(final int shardSnapshotDataThreshold) { + checkArgument(shardSnapshotDataThreshold >= 0); + raftConfig.setSnapshotDataThreshold(shardSnapshotDataThreshold); + } + private void setSnapshotBatchCount(final long shardSnapshotBatchCount) { raftConfig.setSnapshotBatchCount(shardSnapshotBatchCount); } @@ -450,6 +458,11 @@ public class DatastoreContext implements ClientActorConfig { return this; } + public Builder shardSnapshotDataThreshold(final int shardSnapshotDataThreshold) { + datastoreContext.setSnapshotDataThreshold(shardSnapshotDataThreshold); + return this; + } + public Builder shardHeartbeatIntervalInMillis(final int shardHeartbeatIntervalInMillis) { datastoreContext.setHeartbeatInterval(shardHeartbeatIntervalInMillis); return this;