cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Lamanna <>
Subject Fixing the schema for a Column Family
Date Sat, 29 Dec 2012 01:22:15 GMT
Hello folks --

I just ran into this nasty Cassandra issue:

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

alter column family values
  with column_type = 'Standard'
  and comparator =
  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 =
  and caching = 'KEYS_ONLY'
  and compression_options = {'sstable_compression' :
  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

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.


View raw message