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