You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2010/11/24 04:29:15 UTC

[jira] Created: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

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


{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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936030#action_12936030 ] 

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

Actually it is trying to convert column names according to comparator on CF create/update but the problem was that if CF was marked as Super it was still using "cf_def.comparator" instead of "cf_def.subcomparator" to validate names, so 
{code}
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}
was doing a wrong thing and on "describe_keyspace" cf_def.comparator was used all the time so it wasn't working... So in my patch I have fixed it to use "subcomparator" for Super. Isn't this correct?

> 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: 1773-server-side.txt, 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12964421#action_12964421 ] 

Jonathan Ellis commented on CASSANDRA-1773:
-------------------------------------------

bq. if CF was marked as Super it was still using "cf_def.comparator"

you're right, subcomparator is the correct behavior.  it doesn't make sense to add metadata to the supercolumn itself since supercolumns do not have byte[] values.

committed.

> 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: 1773-server-side.txt, 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.


[jira] Updated: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-1773:
--------------------------------------

    Attachment: 1773-server-side.txt

Patch to validate on the server side attached.

What we still need on the cli side is attempting to convert column_metadata column names into bytes with the comparator instead of assuming utf8; if they fail to convert a client-side error should be raised.

> 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: 1773-server-side.txt, 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936022#action_12936022 ] 

Jonathan Ellis commented on CASSANDRA-1773:
-------------------------------------------

This is making negative progress.  The UUID error from describe after

{code}
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}

was correct, and now we don't get that error.

But the correct place to do that validation is on the server, I will make a patch for that.

> 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935824#action_12935824 ] 

Jonathan Ellis commented on CASSANDRA-1773:
-------------------------------------------

it looks like this patch is doing something w/ describe_keyspace and super columns, but not doing anything to prevent us from adding inconsistent metadata to the system

> 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970398#action_12970398 ] 

Hudson commented on CASSANDRA-1773:
-----------------------------------

Integrated in Cassandra-0.7 #70 (See [https://hudson.apache.org/hudson/job/Cassandra-0.7/70/])
    

> 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 rc 2
>
>         Attachments: 1773-server-side.txt, 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.


[jira] Updated: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Yaskevich updated CASSANDRA-1773:
---------------------------------------

    Attachment: CASSANDRA-1773.patch

> 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (CASSANDRA-1773) Prevent creation of column_metadata inconsistent with comparator

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936023#action_12936023 ] 

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

Should we be using subcomparator for columns of the column family marked as "Super" instead of using comparator?

> 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.