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

Michael Theroux commented on CASSANDRA-14539:
---------------------------------------------

Given that there are workarounds I don't think I have a very strong argument to 
patch a release that is officially "*critical fixes only",* although it seems 
it was one of the last critical fix that introduced this.  **  

Appreciate the time.

> cql2 insert/update/batch statements don't function unless the keyspace is 
> specified in the statement
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-14539
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14539
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Michael Theroux
>            Priority: Major
>             Fix For: 2.1.x
>
>         Attachments: cql2.diff
>
>
> If you perform a cql2 insert/update or batch statement without a keyspace, 
> the following assertion will occur:
> java.lang.AssertionError: null
>  at org.apache.cassandra.config.Schema.getCFMetaData(Schema.java:243) 
> ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.Attributes.maybeApplyExpirationDateOverflowPolicy(Attributes.java:81)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.AbstractModification.getTimeToLive(AbstractModification.java:95)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.UpdateStatement.mutationForKey(UpdateStatement.java:201)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.UpdateStatement.prepareRowMutations(UpdateStatement.java:154)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.UpdateStatement.prepareRowMutations(UpdateStatement.java:125)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:544)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:802) 
> ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1962)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4558)
>  ~[apache-cassandra-thrift-2.1.20.jar:2.1.20]
>  at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4542)
>  ~[apache-cassandra-thrift-2.1.20.jar:2.1.20]
>  at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) 
> ~[libthrift-0.9.2.jar:0.9.2]
>  at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) 
> ~[libthrift-0.9.2.jar:0.9.2]
>  at 
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:206)
>  ~[apache-cassandra-2.1.20.jar:2.1.20]
>  at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  ~[na:1.8.0_151]
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  ~[na:1.8.0_151]
>  
> It will fail with:
>     use test;
>     update users set 'test'='\{"d":1529683115340}' where 
> key='c426f519100da4cb24417bc87c5bfbd6' ;
> But will work fine with:
>     update test.users set 'test'='\{"d":1529683115340}' where 
> key='c426f519100da4cb24417bc87c5bfbd6' ;
>  
> Going through the code, looks like this was introduced with 
> https://issues.apache.org/jira/browse/CASSANDRA-14092 in February 2018.
> In org.apache.cassandra.cql.AbstractNotification.getTimeToLive(), and 
> org.apache.cassandra.cql.BatchStatement.getTimeToLive()
> cassandra is using the keyspace associated with the update statement, which 
> is set to null if its not in the query itself.
> I resolved this myself locally by changing the getTimeToLive() methods to 
> take a default keyspace, and use that if it is unavailable on the statement.  
> The fix looked fairly simple.  I've attached my diff.
> P.S. Yes, I realize that cql2 is deprecated, and no longer supported, however 
> I wanted to get this regression in if someone else hits it as I was unable to 
> find any other reports for this issue.
>  
>  



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