You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2014/05/01 17:29:17 UTC

[jira] [Updated] (CASSANDRA-6831) Updates to COMPACT STORAGE tables via cli drop CQL information

     [ https://issues.apache.org/jira/browse/CASSANDRA-6831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-6831:
----------------------------------------

    Attachment: 0002-CompoundDenseCellNameType-fix.txt
                0001-Properly-recompute-denseness-of-the-table-on-thrift-up.txt

[~mishail] You might not be testing the right commit (or use the right test) because I do get the test failure Tyler mentions.

The problem is a tad subtle, and not directly related to the patch (which mainly uncovered something that was wrong before).  What happens is that when we build the comparator in fromThrit, we don't take the copied CQL metadata to decide if the table is dense or not. This result in the addition of the index, which adds column_metadata where there was none, to switch the comparator from an initially dense one to a sparse one. But that's what confuse the rebuild() since we end up with a non-composite sparse comparator and a CLUSTERING_KEY definition, which incompatible.

Now the reason I said this is not directly related to the patch is that before this patch, fromThrift was already returning a sparse comparator when it shouldn't have (since the table was dense initially), but because we were not copying the CQL metadata, no exception was triggered and the mistake was "repaired" as soon as the update was written on disk since then previous CQL metadata were picked up so that the table was left dense as should be. In other words, the code was fishy and not doing what we meant it to do, but that had no visible consequence out of sheer luck.

Anyway I'm attaching a patch that slightly refactor the fromThrift so that we do take all metadata into account when computing isDense(). The patch is 2.1 only, 2.0 is not affected because we don't compute isDense at the same places.

Now I'll note that while that make the pycassa tests run, there is 3 failures.  One of them is actually due to the fact that the CASSANDRA-6738 patch was incomplete so attaching a simple 2nd patch to fix that (I can create a separate issue for that if people prefer but well, that's a simple fix). The other two failure are super-columns related but I haven't yet looked into them (but it's likely they are not related to this ticket).


> Updates to COMPACT STORAGE tables via cli drop CQL information
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-6831
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6831
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Russell Bradberry
>            Assignee: Mikhail Stepura
>            Priority: Minor
>             Fix For: 1.2.17, 2.0.8, 2.1 beta2
>
>         Attachments: 0001-Properly-recompute-denseness-of-the-table-on-thrift-up.txt, 0002-CompoundDenseCellNameType-fix.txt, 6831-1.2.patch, 6831-2.0-v2.txt, 6831-2.1.patch
>
>
> If a COMPACT STORAGE table is altered using the CLI all information about the column names reverts to the initial "key, column1, column2" namings.  Additionally, the changes in the columns name will not take effect until the Cassandra service is restarted.  This means that the clients using CQL will continue to work properly until the service is restarted, at which time they will start getting errors about non-existant columns in the table.
> When attempting to rename the columns back using ALTER TABLE an error stating the column already exists will be raised.  The only way to get it back is to ALTER TABLE and change the comment or something, which will bring back all the original column names.
> This seems to be related to CASSANDRA-6676 and CASSANDRA-6370
> In cqlsh
> {code}
> Connected to cluster1 at 127.0.0.3:9160.
> [cqlsh 3.1.8 | Cassandra 1.2.15-SNAPSHOT | CQL spec 3.0.0 | Thrift protocol 19.36.2]
> Use HELP for help.
> cqlsh> CREATE KEYSPACE test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
> cqlsh> USE test;
> cqlsh:test> CREATE TABLE foo (bar text, baz text, qux text, PRIMARY KEY(bar, baz) ) WITH COMPACT STORAGE;
> cqlsh:test> describe table foo;
> CREATE TABLE foo (
>   bar text,
>   baz text,
>   qux text,
>   PRIMARY KEY (bar, baz)
> ) WITH COMPACT STORAGE AND
>   bloom_filter_fp_chance=0.010000 AND
>   caching='KEYS_ONLY' AND
>   comment='' AND
>   dclocal_read_repair_chance=0.000000 AND
>   gc_grace_seconds=864000 AND
>   read_repair_chance=0.100000 AND
>   replicate_on_write='true' AND
>   populate_io_cache_on_flush='false' AND
>   compaction={'class': 'SizeTieredCompactionStrategy'} AND
>   compression={'sstable_compression': 'SnappyCompressor'};
> {code}
> Now in cli:
> {code}
>   Connected to: "cluster1" on 127.0.0.3/9160
> Welcome to Cassandra CLI version 1.2.15-SNAPSHOT
> Type 'help;' or '?' for help.
> Type 'quit;' or 'exit;' to quit.
> [default@unknown] use test;
> Authenticated to keyspace: test
> [default@test] UPDATE COLUMN FAMILY foo WITH comment='hey this is a comment';
> 3bf5fa49-5d03-34f0-b46c-6745f7740925
> {code}
> Now back in cqlsh:
> {code}
> cqlsh:test> describe table foo;
> CREATE TABLE foo (
>   bar text,
>   column1 text,
>   value text,
>   PRIMARY KEY (bar, column1)
> ) WITH COMPACT STORAGE AND
>   bloom_filter_fp_chance=0.010000 AND
>   caching='KEYS_ONLY' AND
>   comment='hey this is a comment' AND
>   dclocal_read_repair_chance=0.000000 AND
>   gc_grace_seconds=864000 AND
>   read_repair_chance=0.100000 AND
>   replicate_on_write='true' AND
>   populate_io_cache_on_flush='false' AND
>   compaction={'class': 'SizeTieredCompactionStrategy'} AND
>   compression={'sstable_compression': 'SnappyCompressor'};
> cqlsh:test> ALTER TABLE foo WITH comment='this is a new comment';
> cqlsh:test> describe table foo;
> CREATE TABLE foo (
>   bar text,
>   baz text,
>   qux text,
>   PRIMARY KEY (bar, baz)
> ) WITH COMPACT STORAGE AND
>   bloom_filter_fp_chance=0.010000 AND
>   caching='KEYS_ONLY' AND
>   comment='this is a new comment' AND
>   dclocal_read_repair_chance=0.000000 AND
>   gc_grace_seconds=864000 AND
>   read_repair_chance=0.100000 AND
>   replicate_on_write='true' AND
>   populate_io_cache_on_flush='false' AND
>   compaction={'class': 'SizeTieredCompactionStrategy'} AND
>   compression={'sstable_compression': 'SnappyCompressor'};
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)