diff --git a/CHANGES.txt b/CHANGES.txt index 856672c9da..491792e84a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.0 + * Bump the hints messaging version to match the current one (CASSANDRA-14536) * OffsetAwareConfigurationLoader doesn't set ssl storage port causing bind errors in CircleCI (CASSANDRA-14546) * Report why native_transport_port fails to bind (CASSANDRA-14544) * Optimize internode messaging protocol (CASSANDRA-14485) diff --git a/src/java/org/apache/cassandra/hints/HintsDescriptor.java b/src/java/org/apache/cassandra/hints/HintsDescriptor.java index dd56232c37..12d9598af8 100644 --- a/src/java/org/apache/cassandra/hints/HintsDescriptor.java +++ b/src/java/org/apache/cassandra/hints/HintsDescriptor.java @@ -61,7 +61,8 @@ final class HintsDescriptor private static final Logger logger = LoggerFactory.getLogger(HintsDescriptor.class); static final int VERSION_30 = 1; - static final int CURRENT_VERSION = VERSION_30; + static final int VERSION_40 = 2; + static final int CURRENT_VERSION = VERSION_40; static final String COMPRESSION = "compression"; static final String ENCRYPTION = "encryption"; @@ -215,6 +216,8 @@ final class HintsDescriptor { case VERSION_30: return MessagingService.VERSION_30; + case VERSION_40: + return MessagingService.VERSION_40; default: throw new AssertionError(); } diff --git a/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java b/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java index 08487d1874..2d9f972899 100644 --- a/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java +++ b/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java @@ -29,9 +29,11 @@ import org.junit.Test; import org.apache.cassandra.io.compress.LZ4Compressor; import org.apache.cassandra.io.util.DataOutputBuffer; +import org.apache.cassandra.net.MessagingService; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotSame; +import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.fail; public class HintsDescriptorTest @@ -115,6 +117,17 @@ public class HintsDescriptorTest } } + @Test + public void testMessagingVersion() + { + String errorMsg = "Please update the current Hints messaging version to match the current messaging version"; + int messageVersion = HintsDescriptor.messagingVersion(HintsDescriptor.CURRENT_VERSION); + assertEquals(errorMsg, messageVersion, MessagingService.current_version); + + HintsDescriptor descriptor = new HintsDescriptor(UUID.randomUUID(), HintsDescriptor.CURRENT_VERSION, System.currentTimeMillis(), ImmutableMap.of()); + assertEquals(errorMsg, descriptor.messagingVersion(), MessagingService.current_version); + } + private static void testSerializeDeserializeLoop(HintsDescriptor descriptor) throws IOException { // serialize to a byte array