You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Yongle Zhang (Jira)" <ji...@apache.org> on 2020/11/11 22:24:00 UTC

[jira] [Created] (CASSANDRA-16266) Stress testing a mixed cluster with C* 2.1.0 (seed) and 2.0.0 causes NPE

Yongle Zhang created CASSANDRA-16266:
----------------------------------------

             Summary: Stress testing a mixed cluster with C* 2.1.0 (seed) and 2.0.0 causes NPE
                 Key: CASSANDRA-16266
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16266
             Project: Cassandra
          Issue Type: Bug
            Reporter: Yongle Zhang


Steps to reproduce: 
 # setup a mixed cluster with C* 2.1.0 (seed node) and C* 2.0.0
 # run the stress testing tool, e.g.,

{code:java}
/cassandra/tools/bin/cassandra-stress write n=1000 -rate threads=50 -node 250.16.238.1,250.16.238.2{code}
NPE: 
{code:java}
ERROR [InternalResponseStage:2] 2020-07-22 08:29:36,170 CassandraDaemon.java (line 186) Exception in thread Thread[InternalResponseStage:2,5,main]
java.lang.NullPointerException
  at org.apache.cassandra.serializers.BooleanSerializer.deserialize(BooleanSerializer.java:33)
  at org.apache.cassandra.serializers.BooleanSerializer.deserialize(BooleanSerializer.java:24)
  at org.apache.cassandra.db.marshal.AbstractType.compose(AbstractType.java:142)
  at org.apache.cassandra.cql3.UntypedResultSet$Row.getBoolean(UntypedResultSet.java:106)
  at org.apache.cassandra.config.CFMetaData.fromSchemaNoColumnsNoTriggers(CFMetaData.java:1555)
  at org.apache.cassandra.config.CFMetaData.fromSchema(CFMetaData.java:1642)
  at org.apache.cassandra.config.KSMetaData.deserializeColumnFamilies(KSMetaData.java:305)
  at org.apache.cassandra.db.DefsTables.mergeColumnFamilies(DefsTables.java:270)
  at org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:183)
  at org.apache.cassandra.service.MigrationTask$1.response(MigrationTask.java:66)
  at org.apache.cassandra.net.ResponseVerbHandler.doVerb(ResponseVerbHandler.java:46)
  at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:56)
  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 the `CFMetaData` class of version 2.0.0, there is a boolean field named `replicate_on_write`. In the same class of version 2.1.0, however, this field no longer exists. When serializing this class in function `toSchemaNoColumnsNoTriggers`, it will first write all of its fields into a `RowMutation` (in 2.0.0) / `Mutation` (in 2.1.0) class, and then serialize this “Mutation” like class in the same way. In 2.0.0 the `replicate_on_write` field gets serialized at [https://github.com/apache/cassandra/blob/03045ca22b11b0e5fc85c4fabd83ce6121b5709b/src/java/org/apache/cassandra/config/CFMetaData.java#L1514] .

When deserializing this class in function `fromSchemaNoColumnsNoTriggers`, it reads all its fields from a map-like class `UntypedResultSet.Row`. In 2.0.0 the `replicate_on_write` field gets deserialized at [https://github.com/apache/cassandra/blob/03045ca22b11b0e5fc85c4fabd83ce6121b5709b/src/java/org/apache/cassandra/config/CFMetaData.java#L1555] .

The problem is that the existence of the key is not checked, and the map returns a `null` value because the message from 2.1.0 doesn’t contain the `replicate_on_write` key, which leads to the NullPointerException.

 



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

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