incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Kjellman <mkjell...@barracuda.com>
Subject Re: Fixing the schema for a Column Family
Date Sat, 29 Dec 2012 03:28:12 GMT
I've found that if you drop a column family, the data is still there/snapshotted. If you recreate
the column family as expected the data will repopulate the cf.

From: Charles Lamanna <charles@metricshub.com<mailto:charles@metricshub.com>>
Reply-To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" <user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
Date: Friday, December 28, 2012 5:22 PM
To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" <user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
Subject: Fixing the schema for a Column Family

Hello folks --

I just ran into this nasty Cassandra issue: https://issues.apache.org/jira/browse/CASSANDRA-4805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

As a result, one of my column families had its schema reset. For example, when I created the
column family, this was its schema:
CREATE TABLE values (   rk text,   ck text,   cnt counter,   sum counter,   PRIMARY KEY (rk,
ck) );

And now, it's schema has become:
cqlsh:metrics> describe COLUMNFAMILy values;
CREATE TABLE fifteenminutes (  rk text PRIMARY KEY )

Is there a way to restore the schema? (all my client code expects the original schema?)

I can add back the cnt / sum columns by updating the column_metadata in the Cassandra-Cli
-- however, I cannot find a way to fix the compound primary key. This is the command that
restored everything but the compound primary key:

alter column family values
  with column_type = 'Standard'
  and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
  and default_validation_class = 'CounterColumnType'
  and key_validation_class = 'UTF8Type'
  and read_repair_chance = 0.0
  and dclocal_read_repair_chance = 0.0
  and gc_grace = 864000
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and replicate_on_write = true
  and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'}
  and column_metadata=[
        { column_name:'cnt', validation_class:CounterColumnType },
        { column_name:'sum', validation_class:CounterColumnType }
    ];

Also, FWIW, if I describe the schema of my busted CF, I see the following errors:
Unexpected table structure; may not translate correctly to CQL. expected composite key CF
to have column aliases, but found none
Unexpected table structure; may not translate correctly to CQL. expected [u'rk'] length to
be 2, but it's 1.

Thanks!
Charles

Join Barracuda Networks in the fight against hunger.
To learn how you can help in your community, please visit: http://on.fb.me/UAdL4f




Mime
View raw message