From 558142d988539ae1735c8ff16eb1264ad36d4698 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 5 Nov 2022 03:11:54 +0100 Subject: [PATCH] Obsolete ask-based protocol Mark the switch to use ask-based protocol obsolete and deprecate all classes implementing it. JIRA: CONTROLLER-2053 Change-Id: Ib0f5d6a946090addde255423d51746a52e785b2a Signed-off-by: Robert Varga --- .../src/main/resources/initial/datastore.cfg | 1 + .../controller/cluster/datastore/DatastoreContext.java | 3 +++ .../cluster/datastore/DistributedDataStore.java | 10 ++++++---- .../cluster/datastore/DistributedDataStoreFactory.java | 3 ++- .../src/main/yang/distributed-datastore-provider.yang | 1 + .../databroker/ConcurrentDOMDataBrokerTest.java | 6 +++--- .../cluster/datastore/IntegrationTestKit.java | 4 ++++ .../cluster/datastore/TestDistributedDataStore.java | 1 + .../datastore/shardmanager/ShardManagerTest.java | 8 ++++---- 9 files changed, 25 insertions(+), 12 deletions(-) diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/datastore.cfg b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/datastore.cfg index 678903c74c..272d03a196 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/datastore.cfg +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/datastore.cfg @@ -92,6 +92,7 @@ maximum-message-slice-size=491520 # Enable tell-based protocol between frontend (applications) and backend (shards). Using this protocol # should avoid AskTimeoutExceptions seen under heavy load. Defaults to false (use tell-based protocol). # Set to false to enable ask-based protocol. +# This option is obsolete and will be removed in the next major release. use-tell-based-protocol=true # Tune the maximum number of entries a follower is allowed to lag behind the leader before it is 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 17e0a5c094..f9e6cc9ae6 100644 --- 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 @@ -96,6 +96,7 @@ public class DatastoreContext implements ClientActorConfig { private int shardBatchedModificationCount = DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT; private boolean writeOnlyTransactionOptimizationsEnabled = true; private long shardCommitQueueExpiryTimeoutInMillis = DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS; + @Deprecated(since = "7.0.0", forRemoval = true) private boolean useTellBasedProtocol = true; private boolean transactionDebugContextEnabled = false; private String shardManagerPersistenceId; @@ -365,6 +366,7 @@ public class DatastoreContext implements ClientActorConfig { return transactionDebugContextEnabled; } + @Deprecated(since = "7.0.0", forRemoval = true) public boolean isUseTellBasedProtocol() { return useTellBasedProtocol; } @@ -602,6 +604,7 @@ public class DatastoreContext implements ClientActorConfig { return this; } + @Deprecated(since = "7.0.0", forRemoval = true) public Builder useTellBasedProtocol(final boolean value) { datastoreContext.useTellBasedProtocol = value; return this; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java index 16198ff544..5572d577cc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java @@ -20,23 +20,25 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain; import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction; /** - * Implements a distributed DOMStore using Akka Patterns.ask(). + * Implements a distributed DOMStore using Akka {@code Patterns.ask()}. + * + * @deprecated This implementation is destined for removal, */ +@Deprecated(since = "7.0.0", forRemoval = true) public class DistributedDataStore extends AbstractDataStore { - private final TransactionContextFactory txContextFactory; public DistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster, final Configuration configuration, final DatastoreContextFactory datastoreContextFactory, final DatastoreSnapshot restoreFromSnapshot) { super(actorSystem, cluster, configuration, datastoreContextFactory, restoreFromSnapshot); - this.txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier()); + txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier()); } @VisibleForTesting DistributedDataStore(final ActorUtils actorUtils, final ClientIdentifier identifier) { super(actorUtils, identifier); - this.txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier()); + txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier()); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java index 221db2faea..8a50417f67 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java @@ -83,7 +83,8 @@ public final class DistributedDataStoreFactory { } else { dataStore = new DistributedDataStore(actorSystem, clusterWrapper, config, contextFactory, restoreFromSnapshot); - LOG.info("Data store {} is using ask-based protocol", datastoreName); + LOG.warn("Data store {} is using ask-based protocol, which will be removed in the next major release", + datastoreName); } return dataStore; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang b/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang index cdb534e3a4..eb8173ec8a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang @@ -225,6 +225,7 @@ module distributed-datastore-provider { } leaf use-tell-based-protocol { + status obsolete; default false; type boolean; description "Use a newer protocol between the frontend and backend. This feature is considered diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java index 346578f949..bcaef6bef4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java @@ -47,7 +47,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; import org.mockito.stubbing.Answer; -import org.opendaylight.controller.cluster.datastore.DistributedDataStore; +import org.opendaylight.controller.cluster.datastore.AbstractDataStore; import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.common.api.TransactionCommitFailedException; @@ -431,8 +431,8 @@ public class ConcurrentDOMDataBrokerTest { @Test public void testExtensions() { - DistributedDataStore mockConfigStore = mock(DistributedDataStore.class); - DistributedDataStore mockOperStore = mock(DistributedDataStore.class); + final var mockConfigStore = mock(AbstractDataStore.class); + final var mockOperStore = mock(AbstractDataStore.class); try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of( LogicalDatastoreType.OPERATIONAL, mockOperStore, LogicalDatastoreType.CONFIGURATION, mockConfigStore), futureExecutor)) { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java index 72cfdceeea..8bb274e2e4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java @@ -77,12 +77,14 @@ public class IntegrationTestKit extends ShardTestKit { return datastoreContextBuilder; } + @Deprecated(since = "7.0.0", forRemoval = true) public DistributedDataStore setupDistributedDataStore(final String typeName, final String moduleShardsConfig, final boolean waitUntilLeader, final EffectiveModelContext schemaContext) throws Exception { return setupDistributedDataStore(typeName, moduleShardsConfig, "modules.conf", waitUntilLeader, schemaContext); } + @Deprecated(since = "7.0.0", forRemoval = true) public DistributedDataStore setupDistributedDataStore(final String typeName, final String moduleShardsConfig, final String modulesConfig, final boolean waitUntilLeader, @@ -169,6 +171,7 @@ public class IntegrationTestKit extends ShardTestKit { } } + @Deprecated(since = "7.0.0", forRemoval = true) public DistributedDataStore setupDistributedDataStoreWithoutConfig(final String typeName, final EffectiveModelContext schemaContext) { final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem()); @@ -191,6 +194,7 @@ public class IntegrationTestKit extends ShardTestKit { return dataStore; } + @Deprecated(since = "7.0.0", forRemoval = true) public DistributedDataStore setupDistributedDataStoreWithoutConfig(final String typeName, final EffectiveModelContext schemaContext, final LogicalDatastoreType storeType) { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestDistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestDistributedDataStore.java index 882d0e176b..638b3960c1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestDistributedDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestDistributedDataStore.java @@ -15,6 +15,7 @@ import org.opendaylight.controller.cluster.datastore.shardmanager.AbstractShardM import org.opendaylight.controller.cluster.datastore.shardmanager.TestShardManager; import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; +@Deprecated(since = "7.0.0", forRemoval = true) public class TestDistributedDataStore extends DistributedDataStore implements LocalShardStore { public TestDistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster, diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java index c7dc25fc86..9d31d21544 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java @@ -74,11 +74,11 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.controller.cluster.access.concepts.MemberName; import org.opendaylight.controller.cluster.datastore.AbstractClusterRefActorTest; +import org.opendaylight.controller.cluster.datastore.AbstractDataStore; import org.opendaylight.controller.cluster.datastore.ClusterWrapperImpl; import org.opendaylight.controller.cluster.datastore.DataStoreVersions; import org.opendaylight.controller.cluster.datastore.DatastoreContext; import org.opendaylight.controller.cluster.datastore.DatastoreContextFactory; -import org.opendaylight.controller.cluster.datastore.DistributedDataStore; import org.opendaylight.controller.cluster.datastore.Shard; import org.opendaylight.controller.cluster.datastore.config.Configuration; import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl; @@ -203,12 +203,12 @@ public class ShardManagerTest extends AbstractClusterRefActorTest { } private TestShardManager.Builder newTestShardMgrBuilder() { - return TestShardManager.builder(datastoreContextBuilder).distributedDataStore(mock(DistributedDataStore.class)); + return TestShardManager.builder(datastoreContextBuilder).distributedDataStore(mock(AbstractDataStore.class)); } private TestShardManager.Builder newTestShardMgrBuilder(final Configuration config) { return TestShardManager.builder(datastoreContextBuilder).configuration(config) - .distributedDataStore(mock(DistributedDataStore.class)); + .distributedDataStore(mock(AbstractDataStore.class)); } private Props newShardMgrProps() { @@ -245,7 +245,7 @@ public class ShardManagerTest extends AbstractClusterRefActorTest { private TestShardManager.Builder newTestShardMgrBuilderWithMockShardActor(final ActorRef shardActor) { return TestShardManager.builder(datastoreContextBuilder).shardActor(shardActor) - .distributedDataStore(mock(DistributedDataStore.class)); + .distributedDataStore(mock(AbstractDataStore.class)); } -- 2.36.6