Bump the hints messaging version to match the current one

patch by Jay Zhuang; reviewed by Aleksey Yeschenko for CASSANDRA-14536
This commit is contained in:
Jay Zhuang 2018-06-21 17:33:12 -07:00
parent 5cc68a8735
commit 062ca4c7ca
3 changed files with 18 additions and 1 deletions

View File

@ -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)

View File

@ -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();
}

View File

@ -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