cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ran Tavory <>
Subject Re: Questions regarding batch mutates and transactions
Date Wed, 26 May 2010 09:57:07 GMT
The summary of your question is: is batch_mutate atomic in the general
sense, meaning when used with multiple keys, multiple column families etc,

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,

View raw message