cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-11803) Creating a materialized view on a table with "token" column breaks the cluster
Date Tue, 17 May 2016 13:08:12 GMT

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

Sylvain Lebresne commented on CASSANDRA-11803:
----------------------------------------------

bq. Alternatively, we could try to preserve the quoting so it doesn't blow up

While I haven't looked at the details of this particular case, not preserving the quoting
probably means things don't work well with any quoted identifier, which is just not ok. And
if we handled quoting properly, there shouldn't be any particular problem for reserved keyword.
I also don't think quoting identifiers is too complex since we don't allow escaping character
(we even already have the 3 lines function to do so in {{ColumnIdentifier}}). And of course,
as you said, rejecting this on MV when it's support on the base table wouldn't be very user
friendly at all. So I very much think properly quoting is _the_ right way to fix this. 

> Creating a materialized view on a table with "token" column breaks the cluster
> ------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-11803
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11803
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>         Environment: Kernel:
> Linux 4.4.8-20.46.amzn1.x86_64
> Java:
> Java OpenJDK Runtime Environment (build 1.8.0_91-b14)
> OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
> Cassandra: 
> datastax-ddc-3.3.0-1.noarch
> datastax-ddc-tools-3.3.0-1.noarch
>            Reporter: Victor Trac
>            Assignee: Carl Yeksigian
>             Fix For: 3.x
>
>
> On a new Cassandra cluster, if we create a table with a field called "token" (with quotes)
and then create a materialized view that uses "token", the cluster breaks. A ServerError is
returned, and no further nodetool operations on the sstables work. Restarting the Cassandra
server will also fail. It seems like the entire cluster is hosed.
> We tried this on Cassandra 3.3 and 3.5. 
> Here's how to produce (on an new, empty cassandra 3.5 docker container):
> {code}
> [cqlsh 5.0.1 | Cassandra 3.5 | CQL spec 3.4.0 | Native protocol v4]
> Use HELP for help.
> cqlsh> CREATE KEYSPACE account WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor'
: 1 };
> cqlsh> CREATE TABLE account.session  (
>    ...   "token" blob,
>    ...   account_id uuid,
>    ...   PRIMARY KEY("token")
>    ... )WITH compaction={'class': 'LeveledCompactionStrategy'} AND
>    ...   compression={'sstable_compression': 'LZ4Compressor'};
> cqlsh> CREATE MATERIALIZED VIEW account.account_session AS
>    ...        SELECT account_id,"token" FROM account.session
>    ...        WHERE "token" IS NOT NULL and account_id IS NOT NULL
>    ...        PRIMARY KEY (account_id, "token");
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException:
java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.SyntaxException:
line 1:25 no viable alternative at input 'FROM' (SELECT account_id, token [FROM]...)">
> cqlsh> drop table account.session;
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException:
java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.SyntaxException:
line 1:25 no viable alternative at input 'FROM' (SELECT account_id, token [FROM]...)">
> {code}
> When any sstable*, nodetool, or when the Cassandra process is restarted, this is emitted
on startup and Cassandra exits (copied from a server w/ data):
> {code}
> INFO  [main] 2016-05-12 23:25:30,074 ColumnFamilyStore.java:395 - Initializing system_schema.indexes
> DEBUG [SSTableBatchOpen:1] 2016-05-12 23:25:30,075 SSTableReader.java:480 - Opening /mnt/cassandra/data/system_schema/indexes-0feb57ac311f382fba6d9024d305702f/ma-4-big
(91 bytes)
> ERROR [main] 2016-05-12 23:25:30,143 CassandraDaemon.java:697 - Exception encountered
during startup
> org.apache.cassandra.exceptions.SyntaxException: line 1:59 no viable alternative at input
'FROM' (..., expire_at, last_used, token [FROM]...)
>         at org.apache.cassandra.cql3.ErrorCollector.throwFirstSyntaxError(ErrorCollector.java:101)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.cql3.CQLFragmentParser.parseAnyUnhandled(CQLFragmentParser.java:80)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.cql3.QueryProcessor.parseStatement(QueryProcessor.java:512)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.schema.SchemaKeyspace.fetchView(SchemaKeyspace.java:1128)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.schema.SchemaKeyspace.fetchViews(SchemaKeyspace.java:1092)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:903)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesWithout(SchemaKeyspace.java:879)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.schema.SchemaKeyspace.fetchNonSystemKeyspaces(SchemaKeyspace.java:867)
~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:134) ~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:124) ~[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:229)
[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551)
[apache-cassandra-3.5.0.jar:3.5.0]
>         at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:680)
[apache-cassandra-3.5.0.jar:3.5.0]
> {code}



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

Mime
View raw message