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=daba3fdf8ac18ac889c348b1af017c679603ebb3;hp=2048bde613868ed7bb6ea30e8fa25776d7ecc9a4;hb=0230f37066dfd974accaf36bc712d6f1e60637d0;hpb=a564badf85498c6f2c85c831dcb6319953214b4f 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 2048bde613..daba3fdf8a 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 @@ -8,17 +8,16 @@ package org.opendaylight.controller.cluster.datastore; +import akka.util.Timeout; +import java.util.concurrent.TimeUnit; import org.opendaylight.controller.cluster.datastore.config.ConfigurationReader; import org.opendaylight.controller.cluster.datastore.config.FileConfigurationReader; import org.opendaylight.controller.cluster.raft.ConfigParams; import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties; -import akka.util.Timeout; import scala.concurrent.duration.Duration; import scala.concurrent.duration.FiniteDuration; -import java.util.concurrent.TimeUnit; - /** * Contains contextual data for a data store. * @@ -119,6 +118,8 @@ public class DatastoreContext { private Timeout shardLeaderElectionTimeout = new Timeout(30, TimeUnit.SECONDS); private boolean persistent = true; private ConfigurationReader configurationReader = new FileConfigurationReader(); + private int shardIsolatedLeaderCheckIntervalInMillis = shardHeartbeatIntervalInMillis * 10; + private int shardSnapshotDataThresholdPercentage = 12; public Builder shardTransactionIdleTimeout(Duration shardTransactionIdleTimeout) { this.shardTransactionIdleTimeout = shardTransactionIdleTimeout; @@ -155,6 +156,12 @@ public class DatastoreContext { return this; } + public Builder shardSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) { + this.shardSnapshotDataThresholdPercentage = shardSnapshotDataThresholdPercentage; + return this; + } + + public Builder shardHeartbeatIntervalInMillis(int shardHeartbeatIntervalInMillis) { this.shardHeartbeatIntervalInMillis = shardHeartbeatIntervalInMillis; return this; @@ -180,18 +187,26 @@ public class DatastoreContext { return this; } - public Builder persistent(boolean persistent){ this.persistent = persistent; return this; } + public Builder shardIsolatedLeaderCheckIntervalInMillis(int shardIsolatedLeaderCheckIntervalInMillis) { + this.shardIsolatedLeaderCheckIntervalInMillis = shardIsolatedLeaderCheckIntervalInMillis; + return this; + } + + public DatastoreContext build() { DefaultConfigParamsImpl raftConfig = new DefaultConfigParamsImpl(); raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis, TimeUnit.MILLISECONDS)); raftConfig.setJournalRecoveryLogBatchSize(shardJournalRecoveryLogBatchSize); raftConfig.setSnapshotBatchCount(shardSnapshotBatchCount); + raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage); + raftConfig.setIsolatedLeaderCheckInterval( + new FiniteDuration(shardIsolatedLeaderCheckIntervalInMillis, TimeUnit.MILLISECONDS)); return new DatastoreContext(dataStoreProperties, raftConfig, dataStoreMXBeanType, operationTimeoutInSeconds, shardTransactionIdleTimeout,