// in-memory journal can use before it needs to snapshot
private int snapshotDataThresholdPercentage = 12;
- private int snaphotChunkSize = SNAPSHOT_CHUNK_SIZE;
+ private int snapshotChunkSize = SNAPSHOT_CHUNK_SIZE;
private long electionTimeoutFactor = 2;
private String customRaftPolicyImplementationClass;
this.snapshotDataThresholdPercentage = snapshotDataThresholdPercentage;
}
- public void setSnaphotChunkSize(int snaphotChunkSize) {
- this.snaphotChunkSize = snaphotChunkSize;
+ public void setSnapshotChunkSize(int snapshotChunkSize) {
+ this.snapshotChunkSize = snapshotChunkSize;
}
public void setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize) {
@Override
public int getSnapshotChunkSize() {
- return snaphotChunkSize;
+ return snapshotChunkSize;
}
@Override
MockRaftActorContext leaderActorContext = createActorContextWithFollower();
((DefaultConfigParamsImpl)leaderActorContext.getConfigParams()).setHeartBeatInterval(
new FiniteDuration(1000, TimeUnit.SECONDS));
- ((DefaultConfigParamsImpl)leaderActorContext.getConfigParams()).setSnaphotChunkSize(2);
+ ((DefaultConfigParamsImpl)leaderActorContext.getConfigParams()).setSnapshotChunkSize(2);
leaderActorContext.setReplicatedLog(
new MockRaftActorContext.MockReplicatedLogBuilder().createEntries(0, 4, 1).build());
# cannot be found then the default raft policy will be applied
#custom-raft-policy-implementation=
+# The maximum size (in bytes) for snapshot chunks to be sent during sync
+#shard-snapshot-chunk-size=20480000
public static final String UNKNOWN_DATA_STORE_TYPE = "unknown";
public static final int DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT = 1000;
public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
+ public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
private static Set<String> globalDatastoreTypes = Sets.newConcurrentHashSet();
setIsolatedLeaderCheckInterval(DEFAULT_ISOLATED_LEADER_CHECK_INTERVAL_IN_MILLIS);
setSnapshotDataThresholdPercentage(DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD_PERCENTAGE);
setElectionTimeoutFactor(DEFAULT_SHARD_ELECTION_TIMEOUT_FACTOR);
+ setShardSnapshotChunkSize(DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE);
}
private DatastoreContext(DatastoreContext other) {
setSnapshotDataThresholdPercentage(other.raftConfig.getSnapshotDataThresholdPercentage());
setElectionTimeoutFactor(other.raftConfig.getElectionTimeoutFactor());
setCustomRaftPolicyImplementation(other.customRaftPolicyImplementation);
+ setShardSnapshotChunkSize(other.raftConfig.getSnapshotChunkSize());
}
return transactionDebugContextEnabled;
}
+ public int getShardSnapshotChunkSize() {
+ return raftConfig.getSnapshotChunkSize();
+ }
+
+ public void setShardSnapshotChunkSize(int shardSnapshotChunkSize) {
+ raftConfig.setSnapshotChunkSize(shardSnapshotChunkSize);
+ }
+
public static class Builder {
private final DatastoreContext datastoreContext;
private int maxShardDataChangeExecutorPoolSize =
datastoreContext.setCustomRaftPolicyImplementation(customRaftPolicyImplementation);
return this;
}
+
+ public Builder shardSnapshotChunkSize(int shardSnapshotChunkSize) {
+ datastoreContext.setShardSnapshotChunkSize(shardSnapshotChunkSize);
+ return this;
+ }
}
}
int getMaxShardDataChangeListenerQueueSize();
int getMaxShardDataStoreExecutorQueueSize();
+
+ int getShardSnapshotChunkSize();
}
public int getMaxShardDataStoreExecutorQueueSize() {
return context.getDataStoreProperties().getMaxDataStoreExecutorQueueSize();
}
+
+ @Override
+ public int getShardSnapshotChunkSize() {
+ return context.getShardSnapshotChunkSize();
+ }
+
}
props.getShardCommitQueueExpiryTimeoutInSeconds().getValue().intValue())
.transactionDebugContextEnabled(props.getTransactionDebugContextEnabled())
.customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
+ .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
.build();
return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
props.getShardCommitQueueExpiryTimeoutInSeconds().getValue().intValue())
.transactionDebugContextEnabled(props.getTransactionDebugContextEnabled())
.customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
+ .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
.build();
return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
present in the distributed data store module itself. If this property is set to a class which
cannot be found then the default raft behavior will be applied";
}
+
+ leaf shard-snapshot-chunk-size {
+ default 2048000;
+ type non-zero-uint32-type;
+ description "When sending a snapshot to a follower, this is the maximum size in bytes for
+ a chunk of data.";
+ }
}
// Augments the 'configuration' choice node under modules/module.
import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SHARD_TX_COMMIT_TIMEOUT_IN_SECONDS;
import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SNAPSHOT_BATCH_COUNT;
import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_TX_CREATION_INITIAL_RATE_LIMIT;
+import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Test;
context.getDataStoreProperties().getMaxDataChangeListenerQueueSize());
assertEquals(InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE,
context.getDataStoreProperties().getMaxDataStoreExecutorQueueSize());
+ assertEquals(DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE, context.getShardSnapshotChunkSize());
}
@Test
InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE + 1);
builder.maxShardDataStoreExecutorQueueSize(
InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE + 1);
+ builder.shardSnapshotChunkSize(DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE+1);
DatastoreContext context = builder.build();
context.getDataStoreProperties().getMaxDataChangeListenerQueueSize());
assertEquals(InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE + 1,
context.getDataStoreProperties().getMaxDataStoreExecutorQueueSize());
+ assertEquals(DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE + 1, context.getShardSnapshotChunkSize());
}
}