From user-return-19566-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Fri Aug 5 07:26:42 2011 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 73BEC7EAA for ; Fri, 5 Aug 2011 07:26:42 +0000 (UTC) Received: (qmail 44415 invoked by uid 500); 5 Aug 2011 07:26:40 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 44029 invoked by uid 500); 5 Aug 2011 07:26:24 -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 44012 invoked by uid 99); 5 Aug 2011 07:26:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2011 07:26:20 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jsevellec@gmail.com designates 209.85.161.172 as permitted sender) Received: from [209.85.161.172] (HELO mail-gx0-f172.google.com) (209.85.161.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2011 07:26:12 +0000 Received: by gxk19 with SMTP id 19so1746289gxk.31 for ; Fri, 05 Aug 2011 00:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vNsiuv9e5UvG8aPph+b4gX9CfDP5mkwnN1EGTJNCy/I=; b=YjkzliI7GAnvDSzyLSpvrry0ejwoM9jJy8OadWZjR11pgcV4Im9obfc4+FmHit3+1p lFzk5LsFI/AR+c1AOWss9slUJIuof45QbhpkI0e0oyGe26Xr+OKWTNstjOAluFnQ2NOl 9echqaUddJua454e/E2xMRkiSoDCDopJzur2o= MIME-Version: 1.0 Received: by 10.236.161.135 with SMTP id w7mr256833yhk.244.1312529152096; Fri, 05 Aug 2011 00:25:52 -0700 (PDT) Received: by 10.236.41.40 with HTTP; Fri, 5 Aug 2011 00:25:52 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Aug 2011 09:25:52 +0200 Message-ID: Subject: Re: transaction principle between multiple column families From: =?UTF-8?B?SsOpcsOpbXkgU0VWRUxMRUM=?= To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=20cf30549fe5de397104a9bd01b3 X-Virus-Checked: Checked by ClamAV on apache.org --20cf30549fe5de397104a9bd01b3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Aaron, Thank's for your answer. In my case, insertions on my multiple CF's are not on the same key. I've ever read the presentation you advise to me and i think that write transaction log in a special CF is the track i will follow to try to solve my problem. Cheers, 2011/8/5 aaron morton > A write for a single row is atomic, including writing to multiple CF's in > with the same row key. > http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic > > They are not isolated though, reads may see the write partially applied. > > Have a look at the data modelling slides here > http://www.datastax.com/events/cassandrasf2011/presentations for a > discussion on how to create an application Tx log. > > Rollback is difficult / impossible if you are doing updates, you would ne= ed > to understand what to roll the value back to and would have to lock anyon= e > else updating until you have finished the abort. Which is probably > (technically) an unbounded wait. > > Most people use zookeeper / cages to serialise access to a particular key= . > Cheers > > ----------------- > ----------------- > Aaron Morton > Freelance Cassandra Developer > @aaronmorton > http://www.thelastpickle.com > > On 4 Aug 2011, at 17:31, J=C3=A9r=C3=A9my SEVELLEC wrote: > > Hi All, > > Making "transaction" like is my actual preoccupation of the moment. > > My (simplified) need is : > > - update data in column family #1 > - insert data in column family #2 > > My need is to see these operations in a single "transaction" because the > data is tightly coupled. > > I use zookeeper/cage to make distributed lock to avoid multiple client > inserting or updating on the same data. > > But there is a problem there is a fail when inserting in column family 2 > because i have to "rollback" updated data of the column family #1. > > > My reading on the subject is that to solve the fail : > - Can we really consider that "write never fail" with cassandra from the > time the execution of a mutation happened on a node. What can be the caus= e > of fail at this point? > So is it important to thinking about this potential problem? (yes in my > opinion but i'm not totally sure). > - Make a retry first. Is there really a chance for the second try to > succeed if the first fail? > - keep the "transaction data" to have the possibility to rollback > programmatically by deleting the inserting data. The problem is on the > updated data to rollback because old values are lost. I read what "Read > before write" is a bad idea to save old values before the update. the > problem remains, so how to do? > > > Do you have any feedback on this topic? > > Regards, > > -- > J=C3=A9r=C3=A9my > > > --=20 J=C3=A9r=C3=A9my --20cf30549fe5de397104a9bd01b3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Aaron,

Thank's for your answer.
<= div>
In my case, insertions on my multiple CF's are not o= n the same key.

I've ever read the presentatio= n you advise to me and i think that write transaction log in a special CF i= s the track i will follow to try to solve my problem.

Cheers,


2011/8/5 aaron morton <aaron@thelastpickle.com>
A write for a single row is atomic= , including writing to multiple CF's in with the same row key.=C2=A0http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic

They are not isolated though, reads may see the write p= artially applied.=C2=A0

Have a look at the data modelli= ng slides here=C2=A0http://www.datastax.com/events/cassandr= asf2011/presentations=C2=A0for a discussion on how to create an applica= tion Tx log.=C2=A0

Rollback is difficult / impossible if you are doing updates,= you would need to understand what to roll the value back to and would have= to lock anyone else updating until you have finished the abort. Which is p= robably (technically) an unbounded wait.

Most people use zookeeper / cages to serialise access t= o a particular key.=C2=A0
Cheers

-------= ----------
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelast= pickle.com

On 4 Aug 2011, at 17:31, J=C3=A9r=C3=A9my SEVELLEC wrote:
Hi All,

Making= "transaction" like is my actual preoccupation of the moment.

My (simp= lified) need is :

- update data in column family #1
= - insert data in column family #2

My need is to see these operations in a single "transaction&quo= t; because the data is tightly coupled.

I use zookeeper/cage to make distributed lock to avoid multiple client = inserting or updating on the same data.

But there is a problem there= is a fail when inserting in column family 2=C2=A0 because i have to "= rollback" updated data of the column family #1.


My reading on the subject is that to solve the fail :
- Can we r= eally consider that "write never fail" with=C2=A0cassandra=C2=A0from the time the execution of a mut= ation happened on a node. What can be the cause of fail at this point?
So is it important to thinking about this potential problem? (yes in my opi= nion but i'm not totally sure).
- Make a retry first. Is there reall= y a chance for the second try to succeed if the first fail?
-=C2=A0 keep= the "transaction data" to have the possibility to rollback progr= ammatically by deleting the inserting data. The problem is on the updated d= ata to rollback because old values are lost. I read what "Read before = write" is a bad idea to save old values before the update. the problem= remains, so how to do?


Do you have any feedback on this topic?

Regards,

--J=C3=A9r=C3=A9my





--
J=C3=A9r=C3=A9my
--20cf30549fe5de397104a9bd01b3--