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-11064) Failed aggregate creation breaks server permanently
Date Thu, 04 Feb 2016 16:17:40 GMT

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

Sylvain Lebresne commented on CASSANDRA-11064:
----------------------------------------------

We don't want to just change {{AbstractCompositeType}}, we want to change it for all custom
types since any custom type can have this problem. I've pushed a modified commit to do that
but also does the following changes compared to Robert's commit:
* not sure why the added call to {{ByteBuffer.duplicate}} in {{CQL3Type.asCQLLiteral}}. At
least it's not immediatly clear to me what in the patch required it.
* I slightly modified the changes to {{CreateAggregateStatement}}: if converting back and
forth the initcond fails, that's really a bug in the code so I made it an assert. But I did
add a prior call to {{AbstractType.validate}} because that's what we should use for validation.

|| [patch| https://github.com/pcmanus/cassandra/commits/11064-3.0] || [utest|http://cassci.datastax.com/job/pcmanus-11064-3.0-testall/]
|| [dtest|http://cassci.datastax.com/job/pcmanus-11064-3.0-dtest/] ||

bq. having the 3.0.0-GA version would eliminate the ugly stack traces in the unit test

True, didn't realized the current driver was crapping on itself even when using a blob. Anyway,
didn't meant we shouldn't upgrade, but let's just do that in CASSANDRA-11001.

bq. Shall we target 2.2

Could be wrong, but I don't think we have a problem in 2.2 since we keep the {{INITCOND}}
as a blob in the schema.


> Failed aggregate creation breaks server permanently
> ---------------------------------------------------
>
>                 Key: CASSANDRA-11064
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11064
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Olivier Michallat
>            Assignee: Robert Stupp
>             Fix For: 3.0.x
>
>
> While testing edge cases around aggregates, I tried the following to see if custom types
were supported:
> {code}
> ccm create v321 -v3.2.1 -n3
> ccm updateconf enable_user_defined_functions:true
> ccm start
> ccm node1 cqlsh
> CREATE FUNCTION id(i 'DynamicCompositeType(s => UTF8Type, i => Int32Type)')
> RETURNS NULL ON NULL INPUT
> RETURNS 'DynamicCompositeType(s => UTF8Type, i => Int32Type)'
> LANGUAGE java
> AS 'return i;';
> // function created successfully
> CREATE AGGREGATE ag()
> SFUNC id
> STYPE 'DynamicCompositeType(s => UTF8Type, i => Int32Type)'
> INITCOND 's@foo:i@32';
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException:
java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.SyntaxException:
Failed parsing CQL term: [s@foo:i@32] reason: SyntaxException line 1:1 no viable alternative
at character '@'">{code}
> Despite the error, the aggregate appears in system tables:
> {code}
> select * from system_schema.aggregates;
>  keyspace_name | aggregate_name | ...
> ---------------+----------------+ ...
>           test |             ag | ...
> {code}
> But you can't drop it, and trying to drop its function produces the server error again:
> {code}
> DROP AGGREGATE ag;
> InvalidRequest: code=2200 [Invalid query] message="Cannot drop non existing aggregate
'test.ag'"
> DROP FUNCTION id;
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException:
java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.SyntaxException:
Failed parsing CQL term: [s@foo:i@32] reason: SyntaxException line 1:1 no viable alternative
at character '@'">
> {code}
> What's worse, it's now impossible to restart the server:
> {code}
> ccm stop; ccm start
> org.apache.cassandra.exceptions.SyntaxException: Failed parsing CQL term: [s@foo:i@32]
reason: SyntaxException line 1:1 no viable alternative at character '@'
> 	at org.apache.cassandra.cql3.CQLFragmentParser.parseAny(CQLFragmentParser.java:48)
> 	at org.apache.cassandra.cql3.Terms.asBytes(Terms.java:51)
> 	at org.apache.cassandra.schema.SchemaKeyspace.createUDAFromRow(SchemaKeyspace.java:1225)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchUDAs(SchemaKeyspace.java:1204)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchFunctions(SchemaKeyspace.java:1129)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:897)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesWithout(SchemaKeyspace.java:872)
> 	at org.apache.cassandra.schema.SchemaKeyspace.fetchNonSystemKeyspaces(SchemaKeyspace.java:860)
> 	at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:125)
> 	at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:115)
> 	at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:229)
> 	at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551)
> 	at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:680)
> {code}



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

Mime
View raw message