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 ? 

Cheers
A
-----------------
Aaron Morton
New Zealand
@aaronmorton

Co-Founder & Principal Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com

On 4/12/2013, at 11:23 am, Ike Walker <[email protected]> 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:
> 
> https://issues.apache.org/jira/browse/CASSANDRA-4857
> 
> 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?
> 
> Thanks.
> 
> -Ike Walker

Reply via email to