You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "B. Todd Burruss" <bb...@real.com> on 2010/08/06 20:08:37 UTC

batch_mutate atomicity

if i am using batch_mutate to update/insert two columns in the same CF
and same key, is this an atomic operation?

i understand that an operation on a single key in a CF is atomic, but
not sure if the above scenario boils down to two operations or
considered one operation.

thx


Re: batch_mutate atomicity

Posted by Peter Schuller <pe...@infidyne.com>.
> I am using the familiar meanings from ACID:
>
> atomic means either the entire update will succeed or none of it.
>
> isolated means other threads will not see partial updates while it is
> being applied.

A related concern is whether there is a write *ordering* guarantee for
mutations within a row key. Ensuring consistency in the face of
concurrent access can in some (probably several) cases become a lot
easier with an ordering guarantee which would otherwise necessitate an
RPC call between potentially every mutation (depending on where
dependencies between writes are).

Upon cursory inspection it *seems* to me that ordering is maintained,
but even if this is correct, can one consider Cassandra to have such
an ordering guarantee or is any such behavior an artifact of current
implementation details?

By ordering guarantee I am only thinking of single column reads or
distinct get_slice() calls; I am not expecting ordering guarantees
w.r.t. visibility within a single get_slice(). (Additionally I am
assuming QUOROM or RF=1, else it would not be useful to rely on
anyway.)

-- 
/ Peter Schuller

Re: batch_mutate atomicity

Posted by Benjamin Black <b...@b3k.us>.
The first.

On Sat, Aug 7, 2010 at 10:04 AM, james anderson <ja...@setf.de> wrote:
> good afternoon;
>
> On 2010-08-07, at 15:26 , Jonathan Ellis wrote:
>
>> I am using the familiar meanings from ACID:
>>
>> atomic means either the entire update will succeed or none of it.
>>
>> isolated means other threads will not see partial updates while it is
>> being applied.
>
> yes, those terms are not new.
>
> it remains, that the answer with respect to isolation would be clearer were
> it expressed in terms of cassandra's operations. given the two-level map
> passed to batch_mutate,
>
> is it that another thread could see the effect of some mutation object in
> one entry of the inner key map, but not see the effect of some other
> mutation object in the same entry of the inner key map?
>
> or
>
> is it that another thread could see the effect of one set of mutation
> objects in one entry of the inner key map, but not see the effect of some
> other set of mutation object in a different entry of the inner key map?
>
> which one?
>
>>
>> On Sat, Aug 7, 2010 at 12:50 AM, james anderson <ja...@setf.de>
>> wrote:
>>>
>>> good morning;
>>>
>>> On 2010-08-07, at 02:45 , Jonathan Ellis wrote:
>>>
>>>> Everything in the same key of a batch_mutate is atomic.  (But not
>>>> isolated.)
>>>>
>>>
>>> what does the distinction mean in the context of cassandra?
>>> is it that the execution of an operation with the same key could see the
>>> effect of the 'first' mutation on one column family but not another, or
>>> that
>>> they could see the presence/absence of some columns in a row, but not
>>> others, or?
>>>
>>> would it be possible to illustrate the difference with some simple
>>> examples.
>>>
>>>> On Fri, Aug 6, 2010 at 2:15 PM, B. Todd Burruss <bb...@real.com>
>>>> wrote:
>>>>>
>>>>> ok i just saw the FAQ
>>>>> (http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)
>>>>>
>>>>> follow up question ...
>>>>>
>>>>> it states that "As a special case, mutations against a single key are
>>>>> atomic, but more generally no" ... i interpret that to also mean " ..
>>>>> mutations against a single key in the same CF ... "
>>>>>
>>>>> so if i have several mutatations against a single key, but multiple
>>>>> column families i assume this is not atomic?
>>>>>
>>>>> thx
>>>>>
>>>>>
>>>>> On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
>>>>>>
>>>>>> if i am using batch_mutate to update/insert two columns in the same CF
>>>>>> and same key, is this an atomic operation?
>>>>>>
>>>>>> i understand that an operation on a single key in a CF is atomic, but
>>>>>> not sure if the above scenario boils down to two operations or
>>>>>> considered one operation.
>>>>>>
>>>>>> thx
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jonathan Ellis
>>>> Project Chair, Apache Cassandra
>>>> co-founder of Riptano, the source for professional Cassandra support
>>>> http://riptano.com
>>>
>>>
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of Riptano, the source for professional Cassandra support
>> http://riptano.com
>
>

Re: batch_mutate atomicity

Posted by james anderson <ja...@setf.de>.
good afternoon;

On 2010-08-07, at 15:26 , Jonathan Ellis wrote:

> I am using the familiar meanings from ACID:
>
> atomic means either the entire update will succeed or none of it.
>
> isolated means other threads will not see partial updates while it is
> being applied.

yes, those terms are not new.

it remains, that the answer with respect to isolation would be  
clearer were it expressed in terms of cassandra's operations. given  
the two-level map passed to batch_mutate,

is it that another thread could see the effect of some mutation  
object in one entry of the inner key map, but not see the effect of  
some other mutation object in the same entry of the inner key map?

or

is it that another thread could see the effect of one set of mutation  
objects in one entry of the inner key map, but not see the effect of  
some other set of mutation object in a different entry of the inner  
key map?

which one?

>
> On Sat, Aug 7, 2010 at 12:50 AM, james anderson  
> <ja...@setf.de> wrote:
>> good morning;
>>
>> On 2010-08-07, at 02:45 , Jonathan Ellis wrote:
>>
>>> Everything in the same key of a batch_mutate is atomic.  (But not
>>> isolated.)
>>>
>>
>> what does the distinction mean in the context of cassandra?
>> is it that the execution of an operation with the same key could  
>> see the
>> effect of the 'first' mutation on one column family but not  
>> another, or that
>> they could see the presence/absence of some columns in a row, but not
>> others, or?
>>
>> would it be possible to illustrate the difference with some simple  
>> examples.
>>
>>> On Fri, Aug 6, 2010 at 2:15 PM, B. Todd Burruss  
>>> <bb...@real.com> wrote:
>>>>
>>>> ok i just saw the FAQ
>>>> (http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)
>>>>
>>>> follow up question ...
>>>>
>>>> it states that "As a special case, mutations against a single  
>>>> key are
>>>> atomic, but more generally no" ... i interpret that to also mean  
>>>> " ..
>>>> mutations against a single key in the same CF ... "
>>>>
>>>> so if i have several mutatations against a single key, but multiple
>>>> column families i assume this is not atomic?
>>>>
>>>> thx
>>>>
>>>>
>>>> On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
>>>>>
>>>>> if i am using batch_mutate to update/insert two columns in the  
>>>>> same CF
>>>>> and same key, is this an atomic operation?
>>>>>
>>>>> i understand that an operation on a single key in a CF is  
>>>>> atomic, but
>>>>> not sure if the above scenario boils down to two operations or
>>>>> considered one operation.
>>>>>
>>>>> thx
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Jonathan Ellis
>>> Project Chair, Apache Cassandra
>>> co-founder of Riptano, the source for professional Cassandra support
>>> http://riptano.com
>>
>>
>
>
>
> -- 
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com


Re: batch_mutate atomicity

Posted by Jonathan Ellis <jb...@gmail.com>.
I am using the familiar meanings from ACID:

atomic means either the entire update will succeed or none of it.

isolated means other threads will not see partial updates while it is
being applied.

On Sat, Aug 7, 2010 at 12:50 AM, james anderson <ja...@setf.de> wrote:
> good morning;
>
> On 2010-08-07, at 02:45 , Jonathan Ellis wrote:
>
>> Everything in the same key of a batch_mutate is atomic.  (But not
>> isolated.)
>>
>
> what does the distinction mean in the context of cassandra?
> is it that the execution of an operation with the same key could see the
> effect of the 'first' mutation on one column family but not another, or that
> they could see the presence/absence of some columns in a row, but not
> others, or?
>
> would it be possible to illustrate the difference with some simple examples.
>
>> On Fri, Aug 6, 2010 at 2:15 PM, B. Todd Burruss <bb...@real.com> wrote:
>>>
>>> ok i just saw the FAQ
>>> (http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)
>>>
>>> follow up question ...
>>>
>>> it states that "As a special case, mutations against a single key are
>>> atomic, but more generally no" ... i interpret that to also mean " ..
>>> mutations against a single key in the same CF ... "
>>>
>>> so if i have several mutatations against a single key, but multiple
>>> column families i assume this is not atomic?
>>>
>>> thx
>>>
>>>
>>> On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
>>>>
>>>> if i am using batch_mutate to update/insert two columns in the same CF
>>>> and same key, is this an atomic operation?
>>>>
>>>> i understand that an operation on a single key in a CF is atomic, but
>>>> not sure if the above scenario boils down to two operations or
>>>> considered one operation.
>>>>
>>>> thx
>>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of Riptano, the source for professional Cassandra support
>> http://riptano.com
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Re: batch_mutate atomicity

Posted by james anderson <ja...@setf.de>.
good morning;

On 2010-08-07, at 02:45 , Jonathan Ellis wrote:

> Everything in the same key of a batch_mutate is atomic.  (But not  
> isolated.)
>

what does the distinction mean in the context of cassandra?
is it that the execution of an operation with the same key could see  
the effect of the 'first' mutation on one column family but not  
another, or that they could see the presence/absence of some columns  
in a row, but not others, or?

would it be possible to illustrate the difference with some simple  
examples.

> On Fri, Aug 6, 2010 at 2:15 PM, B. Todd Burruss <bb...@real.com>  
> wrote:
>> ok i just saw the FAQ
>> (http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)
>>
>> follow up question ...
>>
>> it states that "As a special case, mutations against a single key are
>> atomic, but more generally no" ... i interpret that to also mean " ..
>> mutations against a single key in the same CF ... "
>>
>> so if i have several mutatations against a single key, but multiple
>> column families i assume this is not atomic?
>>
>> thx
>>
>>
>> On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
>>> if i am using batch_mutate to update/insert two columns in the  
>>> same CF
>>> and same key, is this an atomic operation?
>>>
>>> i understand that an operation on a single key in a CF is atomic,  
>>> but
>>> not sure if the above scenario boils down to two operations or
>>> considered one operation.
>>>
>>> thx
>>>
>>
>>
>>
>
>
>
> -- 
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com


Re: batch_mutate atomicity

Posted by Jonathan Ellis <jb...@gmail.com>.
Everything in the same key of a batch_mutate is atomic.  (But not isolated.)

On Fri, Aug 6, 2010 at 2:15 PM, B. Todd Burruss <bb...@real.com> wrote:
> ok i just saw the FAQ
> (http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)
>
> follow up question ...
>
> it states that "As a special case, mutations against a single key are
> atomic, but more generally no" ... i interpret that to also mean " ..
> mutations against a single key in the same CF ... "
>
> so if i have several mutatations against a single key, but multiple
> column families i assume this is not atomic?
>
> thx
>
>
> On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
>> if i am using batch_mutate to update/insert two columns in the same CF
>> and same key, is this an atomic operation?
>>
>> i understand that an operation on a single key in a CF is atomic, but
>> not sure if the above scenario boils down to two operations or
>> considered one operation.
>>
>> thx
>>
>
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Re: batch_mutate atomicity

Posted by "B. Todd Burruss" <bb...@real.com>.
ok i just saw the FAQ
(http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic)

follow up question ...

it states that "As a special case, mutations against a single key are
atomic, but more generally no" ... i interpret that to also mean " ..
mutations against a single key in the same CF ... "

so if i have several mutatations against a single key, but multiple
column families i assume this is not atomic?

thx


On Fri, 2010-08-06 at 11:08 -0700, Todd Burruss wrote:
> if i am using batch_mutate to update/insert two columns in the same CF
> and same key, is this an atomic operation?
> 
> i understand that an operation on a single key in a CF is atomic, but
> not sure if the above scenario boils down to two operations or
> considered one operation.
> 
> thx
>