From 3f1fbd6b780f2c040e5f9e214ce14e840f6de2c1 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 29 Dec 2023 02:44:19 +0100 Subject: [PATCH] Switch MemberNode to ClientBackedDatastore DistributedDataStore is on its way out, switch to using the sole AbstractDataStore implementation. JIRA: CONTROLLER-2054 Change-Id: I5a8ee344c56a7a768c373ffa4bc489ef249529ff Signed-off-by: Robert Varga --- .../admin/ClusterAdminRpcServiceTest.java | 6 +++--- .../cluster/datastore/MemberNode.java | 21 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java index ee1879a779..21d608689d 100644 --- a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java +++ b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java @@ -258,11 +258,11 @@ public class ClusterAdminRpcServiceTest { writeCarsNodeAndVerify(newReplicaNode3.operDataStore(), newReplicaNode2.operDataStore()); // Verify all data has been replicated. We expect 4 log entries and thus last applied index of 3 - - // 2 ServerConfigurationPayload entries, the transaction payload entry plus a purge payload. + // 2 ServerConfigurationPayload entries, the transaction payload entry plus a purge payload. RaftStateVerifier verifier = raftState -> { - assertEquals("Commit index", 4, raftState.getCommitIndex()); - assertEquals("Last applied index", 4, raftState.getLastApplied()); + assertEquals("Commit index", 3, raftState.getCommitIndex()); + assertEquals("Last applied index", 3, raftState.getLastApplied()); }; verifyRaftState(leaderNode1.configDataStore(), "cars", verifier); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java index a7c702c6dc..5379051acd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java @@ -28,6 +28,7 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; import org.opendaylight.controller.cluster.access.concepts.MemberName; +import org.opendaylight.controller.cluster.databroker.ClientBackedDataStore; import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier; import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; import org.opendaylight.controller.cluster.raft.client.messages.GetOnDemandRaftState; @@ -124,7 +125,7 @@ public class MemberNode { } try { - IntegrationTestKit.shutdownActorSystem(kit.getSystem(), Boolean.TRUE); + IntegrationTestKit.shutdownActorSystem(kit.getSystem(), true); } catch (RuntimeException e) { LoggerFactory.getLogger(MemberNode.class).warn("Failed to shutdown actor system", e); } @@ -204,7 +205,7 @@ public class MemberNode { * @return this Builder */ public Builder moduleShardsConfig(final String newModuleShardsConfig) { - this.moduleShardsConfig = newModuleShardsConfig; + moduleShardsConfig = newModuleShardsConfig; return this; } @@ -214,7 +215,7 @@ public class MemberNode { * @return this Builder */ public Builder akkaConfig(final String newAkkaConfig) { - this.akkaConfig = newAkkaConfig; + akkaConfig = newAkkaConfig; return this; } @@ -224,7 +225,7 @@ public class MemberNode { * @return this Builder */ public Builder useAkkaArtery(final boolean newUseAkkaArtery) { - this.useAkkaArtery = newUseAkkaArtery; + useAkkaArtery = newUseAkkaArtery; return this; } @@ -234,7 +235,7 @@ public class MemberNode { * @return this Builder */ public Builder testName(final String newTestName) { - this.testName = newTestName; + testName = newTestName; return this; } @@ -244,7 +245,7 @@ public class MemberNode { * @return this Builder */ public Builder waitForShardLeader(final String... shardNames) { - this.waitForshardLeader = shardNames; + waitForshardLeader = shardNames; return this; } @@ -254,7 +255,7 @@ public class MemberNode { * @return this Builder */ public Builder createOperDatastore(final boolean value) { - this.createOperDatastore = value; + createOperDatastore = value; return this; } @@ -264,7 +265,7 @@ public class MemberNode { * @return this Builder */ public Builder schemaContext(final EffectiveModelContext newSchemaContext) { - this.schemaContext = newSchemaContext; + schemaContext = newSchemaContext; return this; } @@ -307,12 +308,12 @@ public class MemberNode { String memberName = new ClusterWrapperImpl(system).getCurrentMemberName().getName(); node.kit.getDatastoreContextBuilder().shardManagerPersistenceId("shard-manager-config-" + memberName); - node.configDataStore = node.kit.setupAbstractDataStore(DistributedDataStore.class, + node.configDataStore = node.kit.setupAbstractDataStore(ClientBackedDataStore.class, "config_" + testName, moduleShardsConfig, true, schemaContext, waitForshardLeader); if (createOperDatastore) { node.kit.getDatastoreContextBuilder().shardManagerPersistenceId("shard-manager-oper-" + memberName); - node.operDataStore = node.kit.setupAbstractDataStore(DistributedDataStore.class, + node.operDataStore = node.kit.setupAbstractDataStore(ClientBackedDataStore.class, "oper_" + testName, moduleShardsConfig, true, schemaContext, waitForshardLeader); } -- 2.36.6