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 a768a4f..999e694 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
@@ -63,13 +63,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.ofSeconds(1))
.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 5e322d5..29e3f15 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
@@ -42,7 +42,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;
@@ -103,8 +104,11 @@
.withProtocol(protocol.get())
.withElectionTimeout(Duration.ofMillis(ELECTION_TIMEOUT_MILLIS))
.withHeartbeatInterval(Duration.ofMillis(HEARTBEAT_INTERVAL_MILLIS))
+ .withElectionThreshold(ELECTION_THRESHOLD)
.withStorage(RaftStorage.newBuilder()
- .withStorageLevel(StorageLevel.MAPPED)
+ .withPrefix(String.format("partition-%s", partition.getId()))
+ .withStorageLevel(StorageLevel.DISK)
+ .withFlushOnCommit()
.withSerializer(new AtomixSerializerAdapter(Serializer.using(StorageNamespaces.RAFT_STORAGE)))
.withDirectory(dataFolder)
.withMaxSegmentSize(MAX_SEGMENT_SIZE)