[ 
https://issues.apache.org/jira/browse/CASSANDRA-14439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16815372#comment-16815372
 ] 

mck commented on CASSANDRA-14439:
---------------------------------

This patch only applies to 2.0
Cassandra 2.0 is end-of-life. It's last version was 2.0.17 released on 21st 
September 2015.

Such mixed versions reads from replicas will fail during the rolling upgrade. 
If this is resulting in failed reads in the client, a workaround would be to 
drop *QUORUM reads to *ONE reads during the upgrade window. 

Closing this ticket out as won't fix. 

> 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: Legacy/Core
>         Environment: Mixed 1.2.18  + 2.0.17 environment, used temporarily 
> during incremental migration process.
>            Reporter: Dariusz Cieslak
>            Assignee: Dariusz Cieslak
>            Priority: Low
>              Labels: easyfix
>         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

Reply via email to