Yongle Zhang created CASSANDRA-16265:
----------------------------------------

             Summary: During rolling upgrade from C* 2.0.0 to 2.1.0, upgraded 
node fails with IllegalArgumentException
                 Key: CASSANDRA-16265
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16265
             Project: Cassandra
          Issue Type: Bug
            Reporter: Yongle Zhang


Steps to reproduce: 
 # start a 2-node C* 2.0.0 cluster with 1 seed. 
 # upgrade the non-seed node to 2.1.0
 # run stress testing using /tools/bin/stress on two nodes, wait or it to 
finish. 

Error stack trace:
{code:java}
java.lang.IllegalArgumentException: No enum constant 
org.apache.cassandra.config.CFMetaData.Caching.{"keys":"ALL", 
"rows_per_partition":"NONE"}
  at java.lang.Enum.valueOf(Enum.java:238)
  at org.apache.cassandra.config.CFMetaData$Caching.valueOf(CFMetaData.java:261)
  at 
org.apache.cassandra.config.CFMetaData.fromSchemaNoColumnsNoTriggers(CFMetaData.java:1567)
  at org.apache.cassandra.config.CFMetaData.fromSchema(CFMetaData.java:1642)
  at 
org.apache.cassandra.config.KSMetaData.deserializeColumnFamilies(KSMetaData.java:312)
  at org.apache.cassandra.db.DefsTables.mergeColumnFamilies(DefsTables.java:309)
  at org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:184)
  at 
org.apache.cassandra.service.MigrationTask$1.response(MigrationTask.java:67)
  at 
org.apache.cassandra.net.ResponseVerbHandler.doVerb(ResponseVerbHandler.java:46)
  at 
org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:57)
  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
{code}
Root cause: Incompatible data 

In 2.0.0 `CFMetaData.Caching` is an enum of 4 possible values. It is serialized 
and deserialized using the Java builtin methods `valueOf` and `toString` for 
enum class. See 
[https://github.com/apache/cassandra/blob/03045ca22b11b0e5fc85c4fabd83ce6121b5709b/src/java/org/apache/cassandra/config/CFMetaData.java#L1567]
 (ser) and 
[https://github.com/apache/cassandra/blob/03045ca22b11b0e5fc85c4fabd83ce6121b5709b/src/java/org/apache/cassandra/config/CFMetaData.java#L1524]
 (de).

In 2.1.0, `CachingOptions` is a class consisting of 2 fields. It is serialized 
and deserialized using a textual form similar to JSON (e.g. the string 
\{"keys":"ALL", "rows_per_partition":"NONE"} in the above log). See 
[https://github.com/apache/cassandra/blob/c6a2c65a75adea9a62896269da98dd036c8e57f3/src/java/org/apache/cassandra/cache/CachingOptions.java#L95]
 (ser) and 
[https://github.com/apache/cassandra/blob/c6a2c65a75adea9a62896269da98dd036c8e57f3/src/java/org/apache/cassandra/cache/CachingOptions.java#L50]
 (de).

Note that in 2.1.0 it will first check whether the input string is one of the 4 
possible values in the old version, and will return a predefined constant for 
these values, so it is compatible with the old versions. Unfortunately the old 
versions have no idea about how to deserialize the string from the new versions.

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to