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

Pavel Yaskevich commented on CASSANDRA-1773:
--------------------------------------------

It does prevent you from adding inconsistent metadata now, this was a bug 
related to the super columns (wrong comparator used for converting/viewing) 
that's why you've been able to create an inconsistent metadata, it's fixed now. 
All column names are checked if each of them could be converted to the 
specified type on create/update of column family, my tests:

{code}
connect localhost/9160;
create keyspace clitest with replication_factor = 1 and placement_strategy = 
'org.apache.cassandra.locator.SimpleStrategy';
use clitest;
create column family bar with column_type = 'Super' and comparator = 
'TimeUUIDType' and subcomparator = 'UTF8Type';
create column family foo with column_type = 'Super' and comparator = 
'TimeUUIDType' and subcomparator = 'UTF8Type' and 
column_metadata=[{column_name:col1, validation_class:UTF8Type}, 
{column_name:col2, validation_class:UTF8Type}];

create column family foo2 
  with 
    comparator=TimeUUIDType 
  and 
    column_metadata=[{column_name:f27cdc0d-f808-11df-909f-e700f669bcfc, 
validation_class:UTF8Type}, 
{column_name:'f03a3f0c-f808-11df-909f-e700f669bcfc', 
validation_class:LongType}];

create column family fooWrong with comparator=LongType and 
column_metadata=[{column_name:no_name, 
validation_class:IntegerType},{column_name:12, validation_class:LongType}, 
{column_name:31337, validation_class:LexicalUUIDType}];

create column family fooWrong2 with column_type=Super and 
subcomparator=LongType and column_metadata=[{column_name:address, 
validation_class:IntegerType}];

-- previous 2 tests should fail

describe keyspace clitest;
drop keyspace clitest;
{code}

> Prevent creation of column_metadata inconsistent with comparator
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-1773
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1773
>             Project: Cassandra
>          Issue Type: Improvement
>    Affects Versions: 0.7.0 rc 1
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>            Priority: Minor
>             Fix For: 0.7.0
>
>         Attachments: CASSANDRA-1773.patch
>
>
> {code}
> create keyspace clitest with replication_factor = 1 and placement_strategy = 
> 'org.apache.cassandra.locator.SimpleStrategy';
> use clitest;
> create column family bar with column_type = 'Super' and comparator = 
> 'TimeUUIDType' and subcomparator = 'UTF8Type';
> create column family foo with column_type = 'Super' and comparator = 
> 'TimeUUIDType' and subcomparator = 'UTF8Type' and 
> column_metadata=[{column_name:col1, validation_class:UTF8Type}, 
> {column_name:col2, validation_class:UTF8Type}];
> {code}
> then, "describe keyspace clitest" will give "UUIDs must be exactly 16 bytes" 
> because it tries to run "col1" through the comparator getString.
> We should check that column names in metadata match the comparator when 
> updating metadata, and also check that the column names are sane if we update 
> the comparator itself.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to