Remove support for pre-Sodium SR1 peers 77/96777/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 2 Jul 2021 11:34:00 +0000 (13:34 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 2 Jul 2021 11:34:48 +0000 (13:34 +0200)
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 <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataStoreVersions.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModificationsTest.java

index 6557337..eb444f2 100644 (file)
@@ -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;
index 8643b94..687905d 100644 (file)
@@ -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;
index 9258c0e..2cb5c81 100644 (file)
@@ -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