Dariusz Cieslak created CASSANDRA-14439: -------------------------------------------
Summary: ClassCastException with mixed 1.2.18 + 2.0.17 environment Key: CASSANDRA-14439 URL: https://issues.apache.org/jira/browse/CASSANDRA-14439 Project: Cassandra Issue Type: Bug Components: Core Environment: Mixed 1.2.18 + 2.0.17 environment, used temporarily during incremental migration process. Reporter: Dariusz Cieslak Attachments: cassandra-class-cast-exception-fix.patch During mixed versions tests I've discovered that mixed 1.2.18 + 2.0.17 environment gives the following exception on 2.0.17 node: {code} java.lang.ClassCastException: org.apache.cassandra.db.SliceByNamesReadCommand cannot be cast to org.apache.cassandra.db.SliceFromReadCommand at org.apache.cassandra.db.SliceFromReadCommandSerializer.serializedSize(SliceFromReadCommand.java:242) at org.apache.cassandra.db.ReadCommandSerializer.serializedSize(ReadCommand.java:204) at org.apache.cassandra.db.ReadCommandSerializer.serializedSize(ReadCommand.java:134) at org.apache.cassandra.net.MessageOut.serialize(MessageOut.java:116) at org.apache.cassandra.net.OutboundTcpConnection.writeInternal(OutboundTcpConnection.java:251) at org.apache.cassandra.net.OutboundTcpConnection.writeConnected(OutboundTcpConnection.java:203) at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:151) {code} The exception is caused by inconsistent commandType handling in ReadCommandSerializer(), {code} out.writeByte(newCommand.commandType.serializedValue); switch (command.commandType) /// <----------- WHY NOT newCommand.commandType -- DCI ??? { case GET_BY_NAMES: SliceByNamesReadCommand.serializer.serialize(newCommand, superColumn, out, version); break; case GET_SLICES: SliceFromReadCommand.serializer.serialize(newCommand, superColumn, out, version); break; default: throw new AssertionError(); } {code} Proposed fix (also attached as a patch): {code} diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java index cadcd7d..f2153e8 100644 --- a/src/java/org/apache/cassandra/db/ReadCommand.java +++ b/src/java/org/apache/cassandra/db/ReadCommand.java @@ -153,7 +153,7 @@ class ReadCommandSerializer implements IVersionedSerializer<ReadCommand> } out.writeByte(newCommand.commandType.serializedValue); - switch (command.commandType) + switch (newCommand.commandType) { case GET_BY_NAMES: SliceByNamesReadCommand.serializer.serialize(newCommand, superColumn, out, version); @@ -196,7 +196,7 @@ class ReadCommandSerializer implements IVersionedSerializer<ReadCommand> } } - switch (command.commandType) + switch (newCommand.commandType) { case GET_BY_NAMES: return 1 + SliceByNamesReadCommand.serializer.serializedSize(newCommand, superColumn, version); {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org