cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8090) NullPointerException when using prepared statements
Date Wed, 22 Oct 2014 13:36:33 GMT

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

Benjamin Lerer commented on CASSANDRA-8090:
-------------------------------------------

{quote}Ok. I'm still bugged by the fact we now have to copy the selectors even when there
is no aggregations, but I don't have a very good alternative to suggest so that will do for
now.{quote}

I do not like it so much either but I did not find a nice approach to avoid it.

{quote}I'd rename containsNoAggregateSelectorFactories to containsAggregateFunction: we use
it only negated and the double-negation is harder to read (I also don't think the "SelectorFactories"
part adds much since the method is on SelectorFactories but that's more of a personal taste).
Similarly, containsOnlyAggretateSelectorFactories could just be containsScalarFunction.{quote}

I have simplified the name of the methods but I could not renamed as you suggested as it does
not really have the same meaning.
What we want is that either all the selectors are the one of aggregate functions {{containsOnlyAggretateFunctions}}
or that we do not have any aggregate (which does not means that it is a scalar function, it
can be a column value) {{containsNoAggregateFunctions}}.

I have a new patch [here|https://github.com/blerer/cassandra/compare/CASSANDRA-8090], were
I renamed the 2 methods and moves the selection classes to a new package.

I also noticed that the function selectors were creating an Iterator (by using a for each
instead of a normal for) and a List to hold (the function arguments) for each call (e.g. 10
000 row read with a function will result in 20 000 object created). So I optimized them by
reusing the List and using normal for loop. 


> NullPointerException when using prepared statements
> ---------------------------------------------------
>
>                 Key: CASSANDRA-8090
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8090
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Carl Yeksigian
>            Assignee: Benjamin Lerer
>             Fix For: 3.0
>
>
> Due to the changes in CASSANDRA-4914, using a prepared statement from multiple threads
leads to a race condition where the simple selection may be reset from a different thread,
causing the following NPE:
> {noformat}
> java.lang.NullPointerException: null
> 	at org.apache.cassandra.cql3.ResultSet.addRow(ResultSet.java:63) ~[main/:na]
> 	at org.apache.cassandra.cql3.statements.Selection$ResultSetBuilder.build(Selection.java:372)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:1120)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:283)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:260)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:213)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:63)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:226)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:481)
~[main/:na]
> 	at org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:133)
~[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:438)
[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:334)
[main/:na]
> 	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_67]
> 	at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:163)
[main/:na]
> 	at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:103) [main/:na]
> 	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
> {noformat}
> Reproduced this using the stress tool:
> {noformat}
>  ./tools/bin/cassandra-stress user profile=tools/cqlstress-example.yaml ops\(insert=1,simple1=1\)
> {noformat}
> You'll need to change the {noformat}select:{noformat} line to be /1000 to prevent the
illegal query exceptions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message