From user-return-59460-archive-asf-public=cust-asf.ponee.io@cassandra.apache.org Thu Jan 18 11:19:21 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 95C6A180654 for ; Thu, 18 Jan 2018 11:19:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 85A33160C36; Thu, 18 Jan 2018 10:19:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A5D46160C2B for ; Thu, 18 Jan 2018 11:19:20 +0100 (CET) Received: (qmail 14842 invoked by uid 500); 18 Jan 2018 10:19:18 -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 14832 invoked by uid 99); 18 Jan 2018 10:19:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jan 2018 10:19:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 5A9C21A6F74 for ; Thu, 18 Jan 2018 10:19:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.633 X-Spam-Level: ** X-Spam-Status: No, score=2.633 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=thelastpickle-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id gQZxR0xxWi1A for ; Thu, 18 Jan 2018 10:19:17 +0000 (UTC) Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A31BC5F3DF for ; Thu, 18 Jan 2018 10:19:16 +0000 (UTC) Received: by mail-qt0-f175.google.com with SMTP id s39so11750888qth.7 for ; Thu, 18 Jan 2018 02:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thelastpickle-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=iKtlmUoGvMbJ2R90bIyS6rlGWqcsMLryUMydZcij6+Q=; b=DPJ8FuSVGl+GvDw4onb6mO9XwkcE6wU28/llHsypgWFVLV1GdNKpExjAF9qr2caCr2 C7aMrhjtvK3JGwnTcTzSr31cUMpaW77dtfcc0VVj5D/A2I4W+mCCJSdQFrrvnS+WNME/ dJaLwmTAbtqUOWNkRqXHSVVvFTDAcbqyoo3n9ac1cNaD+lM/pz9vtgkeh2keD7SAbM+H puJbWvpm+DyFc5n4tnSLj4xOoNNsvxHYKM0TDuiZmyFO5XggTQsZ8xe9WFDdCIKRo3/s g4PVjyHgEEui4njHq/pJRZV7d4y7X+8FzWzl4iGnkIStFFXMiIknxgLNYT26JVkGGm7/ VdtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=iKtlmUoGvMbJ2R90bIyS6rlGWqcsMLryUMydZcij6+Q=; b=b7JLn112PRjVmcNd3cA5xKRLpEGL0ROBClkBDK5LRGt2NKKfvEMmVgvfQ4DCTweEly 6lyhLb2YrOqI1b2cTCueC44z0VgreLZhtllIDjtwNmY7F35LfewPJEdvQf8O17pZlTDH jpxEDZw3rNL1cEqM7N41HBsgIG9xHNY1EFYvG2k172KeQro2JRKq5ORjldDojKlMxwjh KFwaK7uAc0vQwiJWfQWXNjCqtF6mpLbT3myDARvCsudmm4bzosMAhpDcZLDAj0lF9dyH XDeZZCcSPdhi1zXV1BfN7PcpFIIgsYethGamepfdaFLU/SOVdR87Q0cwhXt/H/fZeoVj we5w== X-Gm-Message-State: AKwxyteZKDV+ckhPyDAVubwrkhlpbpWqeXdNwW5hQgrkTODovjexiWvi jRBeVPkZhc587UqNPcGP4saaDUgaap+IaffICz2BAMqh X-Google-Smtp-Source: ACJfBouOkD5AGMafHqFYl87uOG8zE8xaHCiieaYWIcT2aUVWBo+ukxoO/Vk/N5/8Cnr8qvST4q8GwJTy3dM5v/017Us= X-Received: by 10.200.2.141 with SMTP id p13mr23392751qtg.229.1516270754920; Thu, 18 Jan 2018 02:19:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Alexander Dejanovski Date: Thu, 18 Jan 2018 10:19:04 +0000 Message-ID: Subject: Re: Alter composite column To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary="f4030435cfb0bb0d5905630a4b5f" --f4030435cfb0bb0d5905630a4b5f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Joel, Sadly it's not possible to alter the primary key of a table in Cassandra. That would require to rewrite all data on disk to match the new partitioning and/or clustering. You need to create a new table and transfer all data from the old one programmatically. Cheers, Le jeu. 18 janv. 2018 =C3=A0 11:14, Joel Samuelsson a =C3=A9crit : > So to rephrase that in CQL terms I have a table like this: > > CREATE TABLE events ( > key text, > column1 int, > column2 int, > column3 text, > value text, > PRIMARY KEY(key, column1, column2, column3) > ) WITH COMPACT STORAGE > > and I'd like to change it to: > CREATE TABLE events ( > key text, > column1 int, > column2 int, > column3 text, > column4 text, > value text, > PRIMARY KEY(key, column1, column2, column3, column4) > ) WITH COMPACT STORAGE > > Is this possible? > Best regards, > Joel > > 2018-01-12 16:53 GMT+01:00 Joel Samuelsson : > >> Hi, >> >> I have an older system (C* 2.1) using Thrift tables on which I want to >> alter a column composite. Right now it looks like (int, int, string) but= I >> want it to be (int, int, string, string). Is it possible to do this on a >> live cluster without deleting the old data? Can you point me to some >> documentation about this? I can't seem to find it any more. >> >> Best regards, >> Joel >> > > -- ----------------- Alexander Dejanovski France @alexanderdeja Consultant Apache Cassandra Consulting http://www.thelastpickle.com --f4030435cfb0bb0d5905630a4b5f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Joel,

Sadly it's not possible to alter the primary key of a ta= ble in Cassandra.
That would require to rewrite all data on disk to match the new partitionin= g and/or clustering.

You need to create a new table and transfer all data from th= e old one programmatically.

Cheers,


Le jeu. 18 janv. 2018 =C3= =A0 11:14, Joel Samuelsson <samuelsson.joel@gmail.com> a =C3=A9crit=C2=A0:
So to rephrase that in CQL terms I hav= e a table like this:

CREATE TABLE events (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 key text,
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 column1 int,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 column2 int,
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 column3 text,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 v= alue text,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 PRIMARY KEY(key, column1, = column2, column3)
) WITH COMPACT STORAGE

and I'd like to change it to:
CREATE TABLE events= (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 key text,
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 column1 int,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 column2 in= t,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 column3 text,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 column4= text,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 value text,
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 PRIMARY KEY(key, column1, column2, column3, column4)
) WITH COMPACT STORAGE

Is this possible?
Best rega= rds,
Joel

2018-01-12 16:53 GMT+01:00 Joel Samuelsson = <samuelss= on.joel@gmail.com>:
Hi,

I have an older system (C* 2.1) using Thri= ft tables on which I want to alter a column composite. Right now it looks l= ike (int, int, string) but I want it to be (int, int, string, string). Is i= t possible to do this on a live cluster without deleting the old data? Can = you point me to some documentation about this? I can't seem to find it = any more.

Best regards,
Joel

--
-----------------
Alexander Dejanovski=
France
@alexan= derdeja

Co= nsultant
Apache Cassandra Consulting
http://www.thelastpickle.com
--f4030435cfb0bb0d5905630a4b5f--