[
https://issues.apache.org/jira/browse/CASSANDRA-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145539#comment-13145539
]
Sylvain Lebresne commented on CASSANDRA-3461:
---------------------------------------------
bq. It appears DynamicCompositeType does not allow mixing different types of
components in the same "position" for the same row
That's correct, or rather, it doesn't support it and all hell will break loose
if you do.
bq. but shouldn't this be a controled error and passed to the client, instead
of throwing a fatal exception in the server side?
That would be great but the caveat is that we cannot do this. Cassandra is
based on that writes don't require a read, so we cannot tell if what you are
inserting right now is compatible with whatever is already inside the database.
It happens that in your example the error is thrown while the second column is
inserted in the active memtable, which is why the client hangs and display
'null' in the end, but just add a flush in between those two inserts and both
will complete successfully but you will get a crash during compaction later.
That do mean that DynamicCompositeType is a very dangerous comparator and I
strongly advise you to not use it (unless you really really have a need for it,
in which case you'd better make sure to protect yourself on the client side,
because we can't do much on the server side). It's very easy to insert data
that will crash in the server later on.
I would agree that based on that the question of whether we should support such
dangerous comparator is a valid one. But it was added initially at the requests
of the Hector guys, that needed it for their object mapping support (or
something like that).
> Server-side fatal exception when mixing column types in DynamicCompositeType
> ----------------------------------------------------------------------------
>
> Key: CASSANDRA-3461
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3461
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.0.0
> Environment: JDK 1.6.0_26
> Reporter: Carlos Carrasco
> Assignee: Sylvain Lebresne
>
> Running this CLI script with cause the Cassandra server to throw a fatal
> exception, and the CLI to hang for some seconds and then just display "null":
> create keyspace Test;
> use Test;
> create column family Composite with comparator ='DynamicCompositeType
> (a=>AsciiType,s=>UTF8Type)';
> set Composite[ascii('key')]['s@one']=ascii('value');
> set Composite[ascii('key')]['a@two']=ascii('value');
> It appears DynamicCompositeType does not allow mixing different types of
> components in the same "position" for the same row, which makes sense, but
> shouldn't this be a controled error and passed to the client, instead of
> throwing a fatal exception in the server side?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira