Repository: cassandra
Updated Branches:
  refs/heads/trunk 5cc68a873 -> 062ca4c7c


Bump the hints messaging version to match the current one

patch by Jay Zhuang; reviewed by Aleksey Yeschenko for CASSANDRA-14536


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/062ca4c7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/062ca4c7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/062ca4c7

Branch: refs/heads/trunk
Commit: 062ca4c7ca753ce1cee08cdc264588208ee2a23c
Parents: 5cc68a8
Author: Jay Zhuang <[email protected]>
Authored: Thu Jun 21 17:33:12 2018 -0700
Committer: Jay Zhuang <[email protected]>
Committed: Mon Jul 2 10:27:27 2018 -0700

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 .../org/apache/cassandra/hints/HintsDescriptor.java    |  5 ++++-
 .../apache/cassandra/hints/HintsDescriptorTest.java    | 13 +++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/062ca4c7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 856672c..491792e 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)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/062ca4c7/src/java/org/apache/cassandra/hints/HintsDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDescriptor.java 
b/src/java/org/apache/cassandra/hints/HintsDescriptor.java
index dd56232..12d9598 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();
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/062ca4c7/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java 
b/test/unit/org/apache/cassandra/hints/HintsDescriptorTest.java
index 08487d1..2d9f972 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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to