You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Christof Bornhoevd <cb...@gmail.com> on 2011/12/08 00:57:27 UTC

Atomic Operations in Cassandra

Hi All,

I'm using Cassandra 1.0.3 (with Hector 0.7). What is the granularity of
atomic read and write operations with Cassandra. I.e. is the insert or
update of an individual column an atomic operation (in the sense that it
either fails or persists completely), or is the insert or update of an
entire row in a ColumnFamily atomic?

Similarly, if I read multiple columns of the same row, could the read
operation interfere with a concurrent write operation on these same columns
in a way that I might see some old and some new column values?

Cheers and thanks a lot for any kind help on this!
Chris

Re: Atomic Operations in Cassandra

Posted by Sylvain Lebresne <sy...@datastax.com>.
On Sun, Dec 11, 2011 at 12:01 PM, Boris Yen <yu...@gmail.com> wrote:
> Hi Sylvain,
>
> "Writes under the same row key are atomic (even across column families) in
> the
> sense that they are either all persisted or none are."
>
> Is this new feature for 1.x, or it also applies to previous version of
> Cassandra?

It applies to previous version of Cassandra.

--
Sylvain

>
> Boris
>
>
> On Thu, Dec 8, 2011 at 6:40 PM, Sylvain Lebresne <sy...@datastax.com>
> wrote:
>>
>> On Thu, Dec 8, 2011 at 12:57 AM, Christof Bornhoevd
>> <cb...@gmail.com> wrote:
>> > Hi All,
>> >
>> > I'm using Cassandra 1.0.3 (with Hector 0.7). What is the granularity of
>> > atomic read and write operations with Cassandra. I.e. is the insert or
>> > update of an individual column an atomic operation (in the sense that it
>> > either fails or persists completely), or is the insert or update of an
>> > entire row in a ColumnFamily atomic?
>> >
>> > Similarly, if I read multiple columns of the same row, could the read
>> > operation interfere with a concurrent write operation on these same
>> > columns
>> > in a way that I might see some old and some new column values?
>>
>> Writes under the same row key are atomic (even across column families) in
>> the
>> sense that they are either all persisted or none are. Note however that it
>> is
>> possible for a insertion to fail for the client (say you get a
>> TimeoutException) but
>> for the insertion to still be persisted.
>> There is however no isolation currently. It is possible for a read to
>> see a state
>> where only part of an insertion (even within the same row key) has been
>> applied.
>> (CASSANDRA-2893 is open to try to add isolation).
>>
>> --
>> Sylvain
>>
>> >
>> > Cheers and thanks a lot for any kind help on this!
>> > Chris
>
>

Re: Atomic Operations in Cassandra

Posted by Boris Yen <yu...@gmail.com>.
Hi Sylvain,

"Writes under the same row key are atomic (*even across column families*)
in the
sense that they are either all persisted or none are."

Is this new feature for 1.x, or it also applies to previous version of
Cassandra?

Boris

On Thu, Dec 8, 2011 at 6:40 PM, Sylvain Lebresne <sy...@datastax.com>wrote:

> On Thu, Dec 8, 2011 at 12:57 AM, Christof Bornhoevd
> <cb...@gmail.com> wrote:
> > Hi All,
> >
> > I'm using Cassandra 1.0.3 (with Hector 0.7). What is the granularity of
> > atomic read and write operations with Cassandra. I.e. is the insert or
> > update of an individual column an atomic operation (in the sense that it
> > either fails or persists completely), or is the insert or update of an
> > entire row in a ColumnFamily atomic?
> >
> > Similarly, if I read multiple columns of the same row, could the read
> > operation interfere with a concurrent write operation on these same
> columns
> > in a way that I might see some old and some new column values?
>
> Writes under the same row key are atomic (even across column families) in
> the
> sense that they are either all persisted or none are. Note however that it
> is
> possible for a insertion to fail for the client (say you get a
> TimeoutException) but
> for the insertion to still be persisted.
> There is however no isolation currently. It is possible for a read to
> see a state
> where only part of an insertion (even within the same row key) has been
> applied.
> (CASSANDRA-2893 is open to try to add isolation).
>
> --
> Sylvain
>
> >
> > Cheers and thanks a lot for any kind help on this!
> > Chris
>

Re: Atomic Operations in Cassandra

Posted by Sylvain Lebresne <sy...@datastax.com>.
On Thu, Dec 8, 2011 at 12:57 AM, Christof Bornhoevd
<cb...@gmail.com> wrote:
> Hi All,
>
> I'm using Cassandra 1.0.3 (with Hector 0.7). What is the granularity of
> atomic read and write operations with Cassandra. I.e. is the insert or
> update of an individual column an atomic operation (in the sense that it
> either fails or persists completely), or is the insert or update of an
> entire row in a ColumnFamily atomic?
>
> Similarly, if I read multiple columns of the same row, could the read
> operation interfere with a concurrent write operation on these same columns
> in a way that I might see some old and some new column values?

Writes under the same row key are atomic (even across column families) in the
sense that they are either all persisted or none are. Note however that it is
possible for a insertion to fail for the client (say you get a
TimeoutException) but
for the insertion to still be persisted.
There is however no isolation currently. It is possible for a read to
see a state
where only part of an insertion (even within the same row key) has been applied.
(CASSANDRA-2893 is open to try to add isolation).

--
Sylvain

>
> Cheers and thanks a lot for any kind help on this!
> Chris