Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 66795 invoked from network); 26 May 2010 09:58:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 May 2010 09:58:02 -0000 Received: (qmail 87484 invoked by uid 500); 26 May 2010 09:58:01 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87461 invoked by uid 500); 26 May 2010 09:58:01 -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 87453 invoked by uid 99); 26 May 2010 09:58:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 09:58:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rantav@gmail.com designates 209.85.160.172 as permitted sender) Received: from [209.85.160.172] (HELO mail-gy0-f172.google.com) (209.85.160.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 09:57:54 +0000 Received: by gyh4 with SMTP id 4so2868129gyh.31 for ; Wed, 26 May 2010 02:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=o7+H33netSrCOtkdxs6ghoAQ7XXYcmrnKgo/j4H7Aa0=; b=AH02LWllxdUFra/11sbxe+n3HhiLGp+cGgX0MFBRuyD7SXu/8Ixhy8XZi/wCpG6ZQ/ X+DT2LAuKyBlxAzks6o1FE/M+KLqk/WfPU1XP2WeMJuwZjJLyF9Q9SjsP/1QZCYglnvw tv2Mwp3nVlbMR2L643j6lasW35VHh5I3SX78I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=JJIJsC7ef28Focxbm8+iWkNHtH+k0ojr1AZA6Omu42nnP8MzClOV7+/yHBxkJqfxiy Lql3VJAIEFzLPRSnDy8OVqjldwmgEO6G1cT4H5/vbIkC/rC1dnXRbTl/h78ZruOLrFQ5 fHJj/Cuvxn8GIF4F4fDO2HGwL73XEJCXNuYvs= Received: by 10.231.183.19 with SMTP id ce19mr27804ibb.35.1274867847439; Wed, 26 May 2010 02:57:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.172.79 with HTTP; Wed, 26 May 2010 02:57:07 -0700 (PDT) In-Reply-To: References: From: Ran Tavory Date: Wed, 26 May 2010 12:57:07 +0300 Message-ID: Subject: Re: Questions regarding batch mutates and transactions To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0016364ecbbc2ea5fe04877c4d91 X-Virus-Checked: Checked by ClamAV on apache.org --0016364ecbbc2ea5fe04877c4d91 Content-Type: text/plain; charset=UTF-8 The summary of your question is: is batch_mutate atomic in the general sense, meaning when used with multiple keys, multiple column families etc, correct? On Wed, May 26, 2010 at 12:45 PM, Todd Nine wrote: > Hey guys, > I originally asked this on the Hector group, but no one was sure of the > answer. Can I get some feedback on this. I'd prefer to avoid having to use > something like Cages if I can for most of our use cases. Long term I can > see we'll need to use something like Cages, especially when it comes to > complex operations such as billing. However for a majority of our uses, I > think it's a bit overkill. I've used transactions heavily in the workplace > on SQL based app developments. To be honest, a majority of application's > I've built utilize optimistic locking, and only the atomic, consistent, and > durable functionality of transactional ACID properties. > > To encapsulate all 3, I essentially need all writes to cassandra for a > given business invocation to occur in a single write. With Spring, I would > implement my own transaction manager which simply adds all mutates and > delete ops to a batch mutate. When my transaction commits, I would execute > the mutation on the given keyspace. Now this would only work if the > following semantics apply. I've tried searching for details in Cassandra's > batch mutate, but I'm not finding what I need. Here are 2 use cases as an > example. > > Case 1: Successful update : User adds new contact > > Transaction Start. > Biz op 1. Row is created in "contacts" and all data is added via batch > mutation > Biz op 2. Row is created for an SMS message is created for queueing > through the SMS gateway > return op 2 > return op 1 > Transaction Commit (batch mutate executed) > > Case 2. Failed update: User adds new contact > > Biz op 1. Row is created in "contacts" > Biz op 2. Row is created for SMS message queuing. Fails due to invalid > international phone number format > return op 2 > return op 1 > Transaction is rolled back (batch mutate never executed) > > > Now, here is where I can't find what I need in the doc. In case 1, if my > mutation from biz op 2 were to fail during a batch mutate operation > encapsulating all mutations, does the batch mutation as a whole not get > executed, or would I still have the mutation from op 1 written to cassandra > while the op 2 write fails? > > Thanks, > --0016364ecbbc2ea5fe04877c4d91 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The summary of your question is: is batch_mutate atomic in= the general sense, meaning when used with multiple keys, multiple column f= amilies etc, correct?

On Wed, May 26, 201= 0 at 12:45 PM, Todd Nine <todd@spidertracks.co.nz> wrote:
Hey guys,
=C2=A0=C2=A0I originally aske= d this on the Hector group, but no one was sure of the answer. =C2=A0Can I = get some feedback on this. =C2=A0I'd prefer to avoid having to use some= thing like Cages if I can for most of our use cases. =C2=A0Long = term I can see we'll need to use something like Cages, especially when = it comes to complex operations such as billing. =C2=A0However for a majorit= y of our uses, I think it's a bit overkill. =C2=A0I've used transac= tions heavily in the workplace on SQL based app developments. =C2=A0To be h= onest, a majority of application's I've built utilize optimistic lo= cking, and only the atomic, consistent, and durable functionality of transa= ctional ACID properties. =C2=A0

To encapsulate all 3, I essentially nee= d all writes to cassandra for a given business invocation to occur in a sin= gle write. =C2=A0With Spring, I would implement my own transaction manager = which simply adds all mutates and delete ops to a batch mutate. =C2=A0When = my transaction commits, I would execute the mutation on the given keyspace.= =C2=A0Now this would only work if the following semantics apply. =C2=A0I&#= 39;ve tried searching for details in Cassandra's batch mutate, but I= 9;m not finding what I need. =C2=A0Here are 2 use cases as an example.

Case 1: Successful update :=C2=A0User adds new contact<= /div>

Transaction Start.
Biz op=C2=A01. Row is= created in=C2=A0=C2=A0"contacts" and all data is added via batch= mutation
Biz op 2. Row is created for an SMS message is created for queueing =C2=A0t= hrough the SMS gateway
return op 2
return op 1
Transaction Commit (batch mutate executed)

Case = 2. Failed update: User adds new contact

Biz op 1. Row is created in "contacts"
<= div>Biz op 2. Row is created for SMS message queuing. =C2=A0Fails due to in= valid international phone number format
return op 2
ret= urn op 1
Transaction is rolled back (batch mutate never executed)

Now, here is where I can't find what I need = in the doc. =C2=A0In case 1, if my mutation from biz op 2 were to fail duri= ng a batch mutate operation encapsulating all mutations, does the batch mut= ation as a whole not get executed, or would I still have the mutation from = op 1 written to cassandra while the op 2 write fails?

Thanks,

--0016364ecbbc2ea5fe04877c4d91--