X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDatastoreContext.java;h=28fb89d2be3a9756523094f29d5904d6c6f82e3e;hb=c7078128d6f35eebee2f98108ff929dcccfc322d;hp=43af39ff31182759f94744354cd3584ee7fbd75e;hpb=bb248f15d352cdd69e53ff7756fcb2c62cdc3eac;p=controller.git 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 43af39ff31..28fb89d2be 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 @@ -24,6 +24,7 @@ import org.opendaylight.controller.cluster.raft.ConfigParams; import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl; import org.opendaylight.controller.cluster.raft.PeerAddressResolver; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.distributed.datastore.provider.rev140612.DataStoreProperties.ExportOnRecovery; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,6 +57,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; @@ -65,6 +67,8 @@ public class DatastoreContext implements ClientActorConfig { TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES); public static final int DEFAULT_MAX_MESSAGE_SLICE_SIZE = 2048 * 1000; // 2MB public static final int DEFAULT_INITIAL_PAYLOAD_SERIALIZED_BUFFER_CAPACITY = 512; + public static final ExportOnRecovery DEFAULT_EXPORT_ON_RECOVERY = ExportOnRecovery.Off; + public static final String DEFAULT_RECOVERY_EXPORT_BASE_DIR = "persistence-export"; public static final long DEFAULT_SYNC_INDEX_THRESHOLD = 10; @@ -100,6 +104,9 @@ public class DatastoreContext implements ClientActorConfig { private long requestTimeout = AbstractClientConnection.DEFAULT_REQUEST_TIMEOUT_NANOS; private long noProgressTimeout = AbstractClientConnection.DEFAULT_NO_PROGRESS_TIMEOUT_NANOS; private int initialPayloadSerializedBufferCapacity = DEFAULT_INITIAL_PAYLOAD_SERIALIZED_BUFFER_CAPACITY; + private boolean useLz4Compression = false; + private ExportOnRecovery exportOnRecovery = DEFAULT_EXPORT_ON_RECOVERY; + private String recoveryExportBaseDir = DEFAULT_RECOVERY_EXPORT_BASE_DIR; public static Set getGlobalDatastoreNames() { return GLOBAL_DATASTORE_NAMES; @@ -112,6 +119,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); @@ -144,6 +152,9 @@ public class DatastoreContext implements ClientActorConfig { this.requestTimeout = other.requestTimeout; this.noProgressTimeout = other.noProgressTimeout; this.initialPayloadSerializedBufferCapacity = other.initialPayloadSerializedBufferCapacity; + this.useLz4Compression = other.useLz4Compression; + this.exportOnRecovery = other.exportOnRecovery; + this.recoveryExportBaseDir = other.recoveryExportBaseDir; setShardJournalRecoveryLogBatchSize(other.raftConfig.getJournalRecoveryLogBatchSize()); setSnapshotBatchCount(other.raftConfig.getSnapshotBatchCount()); @@ -151,6 +162,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()); @@ -302,6 +314,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); } @@ -352,6 +369,18 @@ public class DatastoreContext implements ClientActorConfig { return useTellBasedProtocol; } + public boolean isUseLz4Compression() { + return useLz4Compression; + } + + public ExportOnRecovery getExportOnRecovery() { + return exportOnRecovery; + } + + public String getRecoveryExportBaseDir() { + return recoveryExportBaseDir; + } + @Override public int getMaximumMessageSliceSize() { return maximumMessageSliceSize; @@ -444,6 +473,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; @@ -568,28 +602,23 @@ public class DatastoreContext implements ClientActorConfig { return this; } - @Deprecated(forRemoval = true) - public Builder maxShardDataChangeExecutorPoolSize(final int newMaxShardDataChangeExecutorPoolSize) { - return this; - } - - @Deprecated(forRemoval = true) - public Builder maxShardDataChangeExecutorQueueSize(final int newMaxShardDataChangeExecutorQueueSize) { + public Builder useTellBasedProtocol(final boolean value) { + datastoreContext.useTellBasedProtocol = value; return this; } - @Deprecated(forRemoval = true) - public Builder maxShardDataChangeListenerQueueSize(final int newMaxShardDataChangeListenerQueueSize) { + public Builder useLz4Compression(final boolean value) { + datastoreContext.useLz4Compression = value; return this; } - @Deprecated(forRemoval = true) - public Builder maxShardDataStoreExecutorQueueSize(final int newMaxShardDataStoreExecutorQueueSize) { + public Builder exportOnRecovery(final ExportOnRecovery value) { + datastoreContext.exportOnRecovery = value; return this; } - public Builder useTellBasedProtocol(final boolean value) { - datastoreContext.useTellBasedProtocol = value; + public Builder recoveryExportBaseDir(final String value) { + datastoreContext.recoveryExportBaseDir = value; return this; }