From 3cd86749fb3224544b32bace13cf28abadd2ec44 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 2 Jul 2021 13:34:00 +0200 Subject: [PATCH] Remove support for pre-Sodium SR1 peers The messages exchanged between cluster participants are versioned to maintain backwards compatibility. Trim how far back we can go to Sodium SR1 -- breaking compatibility with Boron, Fluorine and Neon SR2 software. JIRA: CONTROLLER-1985 Change-Id: I11ba4041242650bc3ad70da3f4b2869df0ca5ceb Signed-off-by: Robert Varga --- .../cluster/datastore/DataStoreVersions.java | 3 +++ .../VersionedExternalizableMessage.java | 8 +++----- .../messages/BatchedModificationsTest.java | 17 +---------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataStoreVersions.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataStoreVersions.java index 6557337b8c..eb444f2d8f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataStoreVersions.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataStoreVersions.java @@ -21,8 +21,11 @@ public final class DataStoreVersions { public static final short HELIUM_2_VERSION = 2; @Deprecated public static final short LITHIUM_VERSION = 3; + @Deprecated public static final short BORON_VERSION = 5; + @Deprecated public static final short FLUORINE_VERSION = 9; + @Deprecated public static final short NEON_SR2_VERSION = 10; public static final short SODIUM_SR1_VERSION = 11; public static final short PHOSPHORUS_VERSION = 12; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java index 8643b94a08..687905d722 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java @@ -42,10 +42,8 @@ public abstract class VersionedExternalizableMessage implements Externalizable, return NormalizedNodeStreamVersion.MAGNESIUM; } else if (version == DataStoreVersions.SODIUM_SR1_VERSION) { return NormalizedNodeStreamVersion.SODIUM_SR1; - } else if (version == DataStoreVersions.NEON_SR2_VERSION) { - return NormalizedNodeStreamVersion.NEON_SR2; } else { - return NormalizedNodeStreamVersion.LITHIUM; + throw new IllegalStateException("Unsupported version " + version); } } @@ -62,9 +60,9 @@ public abstract class VersionedExternalizableMessage implements Externalizable, @Override public final Object toSerializable() { final short ver = getVersion(); - if (ver < DataStoreVersions.BORON_VERSION) { + if (ver < DataStoreVersions.SODIUM_SR1_VERSION) { throw new UnsupportedOperationException("Version " + ver - + " is older than the oldest version supported version " + DataStoreVersions.BORON_VERSION); + + " is older than the oldest version supported version " + DataStoreVersions.SODIUM_SR1_VERSION); } return this; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java index 9258c0ee9c..2cb5c81e9d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java @@ -100,8 +100,7 @@ public class BatchedModificationsTest extends AbstractTest { assertEquals("getTransactionID", tx2, clone.getTransactionId()); assertTrue("isReady", clone.isReady()); assertTrue("isDoCommitOnReady", clone.isDoCommitOnReady()); - assertTrue("participatingShardNames present", clone.getParticipatingShardNames().isPresent()); - assertEquals("participatingShardNames", shardNames, clone.getParticipatingShardNames().get()); + assertEquals("participatingShardNames", Optional.of(shardNames), clone.getParticipatingShardNames()); assertEquals("getModifications size", 0, clone.getModifications().size()); // Test not ready. @@ -114,20 +113,6 @@ public class BatchedModificationsTest extends AbstractTest { assertEquals("getTransactionID", tx2, clone.getTransactionId()); assertFalse("isReady", clone.isReady()); assertEquals("getModifications size", 0, clone.getModifications().size()); - - // Test pre-Flourine - - batched = new BatchedModifications(tx2, DataStoreVersions.BORON_VERSION); - batched.addModification(new WriteModification(writePath, writeData)); - batched.setReady(Optional.of(ImmutableSortedSet.of("one", "two"))); - - clone = (BatchedModifications) SerializationUtils.clone((Serializable) batched.toSerializable()); - - assertEquals("getVersion", DataStoreVersions.BORON_VERSION, clone.getVersion()); - assertEquals("getTransactionID", tx2, clone.getTransactionId()); - assertTrue("isReady", clone.isReady()); - assertFalse("participatingShardNames present", clone.getParticipatingShardNames().isPresent()); - assertEquals("getModifications size", 1, clone.getModifications().size()); } @Test -- 2.36.6