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

Sylvain Lebresne commented on CASSANDRA-5138:
---------------------------------------------

I don't think it is reasonable to have CQL validate on every read that no bad 
data has been added to non compact table through thrift: outside of not being 
particularly simple to implement and error prone, it would be silly performance 
wise.

The fact is, *non* compact CQL3 tables are a CQL3 things and in theory they 
should not be accessible at all through thrift (exactly because thrift has the 
potential of screwing things up). But I do understand the willingness to use 
thrift to look under the cover to see how things are implemented and that 
definitively have educational value. Which imo leaves us with the following 
options:
# do nothing and be clear that 'you shalt not mess up with non compact CQL3 
table through thrift' and that if you do, things may break in unexpected ways.
# add validation on the thrift write path.
# refuse write access to non compact CQL3 tables from thrift by default with an 
option to deactivate that protection "at your own risk".

In an ideal world 2) would be the best solution. However, adding said 
validation is not 2 lines of code, far from it, and there would be the 
maintenance cost of keeping said validation up to date with the evolutions of 
CQL3. So, and especially given that accessing non compact CQL3 table from 
thrift is difficult anyway due to not all metadata being exposed, I'm not 
convinced that adding said validation would be the best use of our developer 
resources. Of course if someone is willing to step up to write and maintain 
that validation code, that's fine, but in the absence of that I would suggest 
3) as a good enough compromise.

                
> Provide a better CQL error when table data does not conform to CQL metadata.
> ----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5138
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5138
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.0
>         Environment: Mac OS X running 1.2
>            Reporter: Brian ONeill
>            Priority: Minor
>         Attachments: northpole.cql
>
>
> When you create a table via CQL, then insert into it via Thrift.  If you 
> inadvertently leave out a component of the column name, in CQL you receive a:
> TSocket read 0 bytes
> Server-side the following exception is logged:
> ERROR 15:19:18,016 Error occurred during processing of message.
> java.lang.ArrayIndexOutOfBoundsException: 3
>       at 
> org.apache.cassandra.cql3.statements.ColumnGroupMap.add(ColumnGroupMap.java:43)
>       at 
> org.apache.cassandra.cql3.statements.ColumnGroupMap.access$200(ColumnGroupMap.java:31)
>       at 
> org.apache.cassandra.cql3.statements.ColumnGroupMap$Builder.add(ColumnGroupMap.java:138)
>       at 
> org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:805)
>       at 
> org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:145)
>       at 
> org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:134)
>       at 
> org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:61)
>       at 
> org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
>       at 
> org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:140)
>       at 
> org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1686)
>       at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
>       at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>       at 
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:680)
> I'll submit a schema, and steps to reproduce.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to