cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-4377) CQL3 column value validation bug
Date Thu, 09 Aug 2012 15:42:20 GMT


Sylvain Lebresne commented on CASSANDRA-4377:

bq. Can you remind me why we don't translate PRIMARY KEY(gid, period, tid) into a comparator
of CompositeType(Int32Type, BytesType, UTF8Type)

We do. The problem is actually with columns that are not part of the key. Let me try to sum
that up:
* Pre-CQL3, the ColumnDefinition name was always a full column name.
* In CQL3, the ColumnDefinition name only correspond to one of the component of the column
name, i.e. to the UTF8Type component above.
* To be able to distinguish both case internally, we've introduce the componentIndex field
in ColumnDefinition. However, we decided that we didn't wanted to expose this field to thrift,
and so we don't expose to thrift the ColumnDefinition from CQL3 table.

The net result is that as far as thrift is concerned, the CQL3 tables have no columns_metadata
whatsoever. It follows that thrift clients don't know what are the correct value for the last
UTF8Type component, and don't know what is the type of the corresponding value (and thus cannot
serialize/deserialize said value correctly). 
> CQL3 column value validation bug
> --------------------------------
>                 Key: CASSANDRA-4377
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.1.1
>            Reporter: Nick Bailey
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1.4
>         Attachments: 4377.txt
> {noformat}
> cqlsh> create keyspace test with strategy_class = 'SimpleStrategy' and strategy_options:replication_factor
= 1;
> cqlsh> use test;
> cqlsh:test> CREATE TABLE stats (
>         ...   gid          blob,
>         ...   period     int,
>         ...   tid          blob, 
>         ...   sum        int,
>         ...   uniques           blob,
>         ...   PRIMARY KEY(gid, period, tid)
>         ... );
> cqlsh:test> describe columnfamily stats;
> CREATE TABLE stats (
>   gid blob PRIMARY KEY
> ) WITH
>   comment='' AND
>   comparator='CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.BytesType,org.apache.cassandra.db.marshal.UTF8Type)'
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   default_validation=text AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write='true' AND
>   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>   compression_parameters:sstable_compression='SnappyCompressor';
> {noformat}
> You can see in the above output that the stats cf is created with the column validator
set to text, but neither of the non primary key columns defined are text. It should either
be setting metadata for those columns or not setting a default validator or some combination
of the two.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message