Upgrade to Atomix 2.0.14
Change-Id: I919aa1337a850f7dc25621d6a990a7d8b4d2ee6f
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
index f5f8a99..723dc51 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
@@ -64,13 +64,15 @@
*/
public class StoragePartitionClient implements DistributedPrimitiveCreator, Managed<StoragePartitionClient> {
+ private static final int MAX_RETRIES = 8;
+ private static final String ATOMIC_VALUES_CONSISTENT_MAP_NAME = "onos-atomic-values";
+
private final Logger log = getLogger(getClass());
private final StoragePartition partition;
private final MemberId localMemberId;
private final RaftClientProtocol protocol;
private RaftClient client;
- private static final String ATOMIC_VALUES_CONSISTENT_MAP_NAME = "onos-atomic-values";
private final com.google.common.base.Supplier<AsyncConsistentMap<String, byte[]>> onosAtomicValuesMap =
Suppliers.memoize(() -> newAsyncConsistentMap(ATOMIC_VALUES_CONSISTENT_MAP_NAME,
Serializer.using(KryoNamespaces.BASIC)));
@@ -110,7 +112,7 @@
.withReadConsistency(ReadConsistency.SEQUENTIAL)
.withCommunicationStrategy(CommunicationStrategy.ANY)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -135,7 +137,7 @@
.withReadConsistency(ReadConsistency.SEQUENTIAL)
.withCommunicationStrategy(CommunicationStrategy.ANY)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -159,7 +161,7 @@
.withReadConsistency(ReadConsistency.SEQUENTIAL)
.withCommunicationStrategy(CommunicationStrategy.ANY)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -189,7 +191,7 @@
.withReadConsistency(ReadConsistency.LINEARIZABLE_LEASE)
.withCommunicationStrategy(CommunicationStrategy.LEADER)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -211,7 +213,7 @@
.withReadConsistency(ReadConsistency.LINEARIZABLE_LEASE)
.withCommunicationStrategy(CommunicationStrategy.LEADER)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -235,7 +237,7 @@
.withReadConsistency(ReadConsistency.LINEARIZABLE_LEASE)
.withCommunicationStrategy(CommunicationStrategy.LEADER)
.withTimeout(Duration.ofSeconds(5))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -250,7 +252,7 @@
.withReadConsistency(ReadConsistency.SEQUENTIAL)
.withCommunicationStrategy(CommunicationStrategy.ANY)
.withTimeout(Duration.ofSeconds(30))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
@@ -266,7 +268,7 @@
.withCommunicationStrategy(CommunicationStrategy.LEADER)
.withMinTimeout(Duration.ofMillis(timeUnit.toMillis(leaderTimeout)))
.withMaxTimeout(Duration.ofSeconds(5))
- .withMaxRetries(5)
+ .withMaxRetries(MAX_RETRIES)
.build()
.open()
.join());
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
index c9cfe53..1b201cd 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
@@ -49,7 +49,8 @@
private static final int MAX_SEGMENT_SIZE = 1024 * 1024 * 64;
private static final long ELECTION_TIMEOUT_MILLIS = 2500;
- private static final long HEARTBEAT_INTERVAL_MILLIS = 250;
+ private static final int ELECTION_THRESHOLD = 5;
+ private static final long HEARTBEAT_INTERVAL_MILLIS = 500;
private final MemberId localMemberId;
private final StoragePartition partition;
@@ -143,9 +144,11 @@
clusterCommunicator))
.withElectionTimeout(Duration.ofMillis(ELECTION_TIMEOUT_MILLIS))
.withHeartbeatInterval(Duration.ofMillis(HEARTBEAT_INTERVAL_MILLIS))
+ .withElectionThreshold(ELECTION_THRESHOLD)
.withStorage(RaftStorage.newBuilder()
.withPrefix(String.format("partition-%s", partition.getId()))
- .withStorageLevel(StorageLevel.MAPPED)
+ .withStorageLevel(StorageLevel.DISK)
+ .withFlushOnCommit()
.withSerializer(new AtomixSerializerAdapter(Serializer.using(StorageNamespaces.RAFT_STORAGE)))
.withDirectory(partition.getDataFolder())
.withMaxSegmentSize(MAX_SEGMENT_SIZE)
@@ -200,9 +203,11 @@
clusterCommunicator))
.withElectionTimeout(Duration.ofMillis(ELECTION_TIMEOUT_MILLIS))
.withHeartbeatInterval(Duration.ofMillis(HEARTBEAT_INTERVAL_MILLIS))
+ .withElectionThreshold(ELECTION_THRESHOLD)
.withStorage(RaftStorage.newBuilder()
.withPrefix(String.format("partition-%s", partition.getId()))
- .withStorageLevel(StorageLevel.MAPPED)
+ .withStorageLevel(StorageLevel.DISK)
+ .withFlushOnCommit()
.withSerializer(new AtomixSerializerAdapter(Serializer.using(StorageNamespaces.RAFT_STORAGE)))
.withDirectory(partition.getDataFolder())
.withMaxSegmentSize(MAX_SEGMENT_SIZE)