Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 130AE1066A for ; Tue, 3 Dec 2013 22:24:30 +0000 (UTC) Received: (qmail 87186 invoked by uid 500); 3 Dec 2013 22:24:27 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87166 invoked by uid 500); 3 Dec 2013 22:24:27 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 87158 invoked by uid 99); 3 Dec 2013 22:24:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 22:24:27 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ike.walker@flite.com designates 209.85.192.179 as permitted sender) Received: from [209.85.192.179] (HELO mail-pd0-f179.google.com) (209.85.192.179) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 22:24:20 +0000 Received: by mail-pd0-f179.google.com with SMTP id r10so21022640pdi.38 for ; Tue, 03 Dec 2013 14:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flite.com; s=google; h=from:content-type:subject:message-id:date:to:mime-version; bh=QGS9T9sHfBijXcN3zvsianTUXilx3lbjUv5K6yjGPcg=; b=G249N7lVO6a1MZlcXD3uwd3y9b5MVW4Imwv5L3AxqStdGtnZSQlDPaIsekRx31C61u WOB6lFeL8QYwpBq7/9xZevt/VGaNkRCaiiwRClg7+WFXcD084fhXS5/zI5kO9FFbZpZo z7qZynUvR4J03GjZybVRb2CEkaGWS2wq3PYUY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:subject:message-id:date:to :mime-version; bh=QGS9T9sHfBijXcN3zvsianTUXilx3lbjUv5K6yjGPcg=; b=bjEZWHmUyz3+16wv1PJKTSUyADHm9TcNcS8vdrJOwGiUZaYCGogFiCur6J3EO9vfQY FPcTEPa0dlTHvwRTIWZjw+DNembJI0HJD/t8dfAQ48ch4zTPoFFs41TU4cSsGPr6QV2b AewM1xTTrPSjrLFuYD6XbBJmZAbkmBfODsspFFRU2C0sW4i5J9IGgalYx4+N3jnz+/dR Jbl0kPyaP8jnvG6lOb2vdWumoeCmC6LDhGZop4OnGk8RUfivzvvMo3t7R4P1RlVyukVJ Fjp+AdmlhrlB16JLLb6qksliaeMIWGaz4u3AJx9HvZ1uXE4xSFsEzWk+bfJF0pscaC54 Xpng== X-Gm-Message-State: ALoCoQk0MNgEQPJ9/sMkV8vaaKDki8DHbJYZDX5QQJMnWAb7F8n/PtAWUskC9QBlgii8mACHigtw X-Received: by 10.66.156.106 with SMTP id wd10mr8587419pab.125.1386109438803; Tue, 03 Dec 2013 14:23:58 -0800 (PST) Received: from [192.168.1.9] (pool-98-110-150-177.bstnma.fios.verizon.net. [98.110.150.177]) by mx.google.com with ESMTPSA id ug2sm22205697pac.21.2013.12.03.14.23.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 14:23:57 -0800 (PST) From: Ike Walker Content-Type: multipart/alternative; boundary="Apple-Mail=_258AD883-62C6-4DC8-810D-AC2DDC3165C8" Subject: CQL workaround for modifying a primary key Message-Id: <96D788E5-39B3-4C4B-A6D3-EF728A453867@flite.com> Date: Tue, 3 Dec 2013 17:23:55 -0500 To: "user@cassandra.apache.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_258AD883-62C6-4DC8-810D-AC2DDC3165C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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= --Apple-Mail=_258AD883-62C6-4DC8-810D-AC2DDC3165C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii 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: