Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG-4626: Introduce NormalizedNodeData{Input,Output}
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
DatastoreContext.java
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 e0c243b5b41ddf3612248e8fc3fec6ab31fd84d3..c8be6aba9dc51f79493925d66a3d80ab27546737 100644
(file)
--- 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
@@
-9,6
+9,7
@@
package org.opendaylight.controller.cluster.datastore;
import akka.util.Timeout;
package org.opendaylight.controller.cluster.datastore;
import akka.util.Timeout;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Sets;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@
-17,6
+18,7
@@
import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
import org.opendaylight.controller.cluster.raft.ConfigParams;
import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
import org.opendaylight.controller.cluster.raft.ConfigParams;
import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
+import org.opendaylight.controller.cluster.raft.PeerAddressResolver;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
@@
-68,7
+70,7
@@
public class DatastoreContext {
private boolean writeOnlyTransactionOptimizationsEnabled = true;
private long shardCommitQueueExpiryTimeoutInMillis = DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS;
private boolean transactionDebugContextEnabled = false;
private boolean writeOnlyTransactionOptimizationsEnabled = true;
private long shardCommitQueueExpiryTimeoutInMillis = DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS;
private boolean transactionDebugContextEnabled = false;
- private String
customRaftPolicyImplementation = ""
;
+ private String
shardManagerPersistenceId
;
public static Set<String> getGlobalDatastoreTypes() {
return globalDatastoreTypes;
public static Set<String> getGlobalDatastoreTypes() {
return globalDatastoreTypes;
@@
-101,7
+103,7
@@
public class DatastoreContext {
this.writeOnlyTransactionOptimizationsEnabled = other.writeOnlyTransactionOptimizationsEnabled;
this.shardCommitQueueExpiryTimeoutInMillis = other.shardCommitQueueExpiryTimeoutInMillis;
this.transactionDebugContextEnabled = other.transactionDebugContextEnabled;
this.writeOnlyTransactionOptimizationsEnabled = other.writeOnlyTransactionOptimizationsEnabled;
this.shardCommitQueueExpiryTimeoutInMillis = other.shardCommitQueueExpiryTimeoutInMillis;
this.transactionDebugContextEnabled = other.transactionDebugContextEnabled;
- this.
customRaftPolicyImplementation = other.customRaftPolicyImplementation
;
+ this.
shardManagerPersistenceId = other.shardManagerPersistenceId
;
setShardJournalRecoveryLogBatchSize(other.raftConfig.getJournalRecoveryLogBatchSize());
setSnapshotBatchCount(other.raftConfig.getSnapshotBatchCount());
setShardJournalRecoveryLogBatchSize(other.raftConfig.getJournalRecoveryLogBatchSize());
setSnapshotBatchCount(other.raftConfig.getSnapshotBatchCount());
@@
-109,9
+111,9
@@
public class DatastoreContext {
setIsolatedLeaderCheckInterval(other.raftConfig.getIsolatedCheckIntervalInMillis());
setSnapshotDataThresholdPercentage(other.raftConfig.getSnapshotDataThresholdPercentage());
setElectionTimeoutFactor(other.raftConfig.getElectionTimeoutFactor());
setIsolatedLeaderCheckInterval(other.raftConfig.getIsolatedCheckIntervalInMillis());
setSnapshotDataThresholdPercentage(other.raftConfig.getSnapshotDataThresholdPercentage());
setElectionTimeoutFactor(other.raftConfig.getElectionTimeoutFactor());
- setCustomRaftPolicyImplementation(other.
customRaftPolicyImplementation
);
+ setCustomRaftPolicyImplementation(other.
raftConfig.getCustomRaftPolicyImplementationClass()
);
setShardSnapshotChunkSize(other.raftConfig.getSnapshotChunkSize());
setShardSnapshotChunkSize(other.raftConfig.getSnapshotChunkSize());
-
+ setPeerAddressResolver(other.raftConfig.getPeerAddressResolver());
}
public static Builder newBuilder() {
}
public static Builder newBuilder() {
@@
-178,6
+180,14
@@
public class DatastoreContext {
return transactionCreationInitialRateLimit;
}
return transactionCreationInitialRateLimit;
}
+ public String getShardManagerPersistenceId() {
+ return shardManagerPersistenceId;
+ }
+
+ private void setPeerAddressResolver(PeerAddressResolver resolver) {
+ raftConfig.setPeerAddressResolver(resolver);
+ }
+
private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis){
raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
TimeUnit.MILLISECONDS));
private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis){
raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
TimeUnit.MILLISECONDS));
@@
-201,7
+211,6
@@
public class DatastoreContext {
raftConfig.setCustomRaftPolicyImplementationClass(customRaftPolicyImplementation);
}
raftConfig.setCustomRaftPolicyImplementationClass(customRaftPolicyImplementation);
}
-
private void setSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) {
raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
}
private void setSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) {
raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
}
@@
-210,6
+219,10
@@
public class DatastoreContext {
raftConfig.setSnapshotBatchCount(shardSnapshotBatchCount);
}
raftConfig.setSnapshotBatchCount(shardSnapshotBatchCount);
}
+ private void setShardSnapshotChunkSize(int shardSnapshotChunkSize) {
+ raftConfig.setSnapshotChunkSize(shardSnapshotChunkSize);
+ }
+
public int getShardBatchedModificationCount() {
return shardBatchedModificationCount;
}
public int getShardBatchedModificationCount() {
return shardBatchedModificationCount;
}
@@
-230,10
+243,6
@@
public class DatastoreContext {
return raftConfig.getSnapshotChunkSize();
}
return raftConfig.getSnapshotChunkSize();
}
- public void setShardSnapshotChunkSize(int shardSnapshotChunkSize) {
- raftConfig.setSnapshotChunkSize(shardSnapshotChunkSize);
- }
-
public static class Builder {
private final DatastoreContext datastoreContext;
private int maxShardDataChangeExecutorPoolSize =
public static class Builder {
private final DatastoreContext datastoreContext;
private int maxShardDataChangeExecutorPoolSize =
@@
-420,6
+429,15
@@
public class DatastoreContext {
return this;
}
return this;
}
+ /**
+ * For unit tests only.
+ */
+ @VisibleForTesting
+ public Builder shardManagerPersistenceId(String id) {
+ datastoreContext.shardManagerPersistenceId = id;
+ return this;
+ }
+
public DatastoreContext build() {
datastoreContext.dataStoreProperties = InMemoryDOMDataStoreConfigProperties.create(
maxShardDataChangeExecutorPoolSize, maxShardDataChangeExecutorQueueSize,
public DatastoreContext build() {
datastoreContext.dataStoreProperties = InMemoryDOMDataStoreConfigProperties.create(
maxShardDataChangeExecutorPoolSize, maxShardDataChangeExecutorQueueSize,
@@
-441,5
+459,10
@@
public class DatastoreContext {
datastoreContext.setShardSnapshotChunkSize(shardSnapshotChunkSize);
return this;
}
datastoreContext.setShardSnapshotChunkSize(shardSnapshotChunkSize);
return this;
}
+
+ public Builder shardPeerAddressResolver(PeerAddressResolver resolver) {
+ datastoreContext.setPeerAddressResolver(resolver);
+ return this;
+ }
}
}
}
}