I just tested this with 1.2.9 and DROP TABLE took a snapshot and moved the existing files out of the dir. 

Do you have some more steps to reproduce ? 

Aaron Morton
New Zealand

Co-Founder & Principal Consultant
Apache Cassandra Consulting

On 4/12/2013, at 11:23 am, Ike Walker <ike.walker@flite.com> wrote:

What is the best practice for modifying the primary key definition of a table in Cassandra 1.2.9?

Say I have this table:

CREATE TABLE temperature (
   weatherstation_id text,
   event_time timestamp,
   temperature text,
   PRIMARY KEY (weatherstation_id,event_time)

I want to add a new column named version and include that column in the primary key.

CQL will let me add the column, but you can't change the primary key for an existing table.

So I drop the table and recreate it:

DROP TABLE temperature;

CREATE TABLE temperature (
   weatherstation_id text,
   version int,
   event_time timestamp,
   temperature text,
   PRIMARY KEY (weatherstation_id,version,event_time)

But then I start getting errors like this:

java.io.FileNotFoundException: /var/lib/cassandra/data/test/temperature/test-temperature-ic-8316-Data.db (No such file or directory)

So I guess the drop table doesn't actually delete the data, and I end up with a problem like this:


What's a good workaround for this, assuming I don;t want to change the name of my table? Should I just truncate the table, then drop it and recreate it?


-Ike Walker