incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Black...@b3k.us>
Subject Re: Curious as to how Cassandra handles the following
Date Sun, 26 Sep 2010 18:44:02 GMT
On Sun, Sep 26, 2010 at 11:04 AM, Lucas Nodine <lucasnodine@gmail.com> wrote:
> I'm looking at a design where multiple clients will connect to Cassandra and
> get/mutate resources, possibly concurrently.  After planning a bit, I ran
> into the following scenero for which I have not been able to research to
> find an answer sufficient for my needs.  I have found where others have
> recommended Zookeeper for such tasks, but I want to determine if there is a
> simple solution before including another product in my design.
>
> Make the following assumption for all following situations:
> Assuming multiple clients where a client is someone accessing Cassandra
> using thrift.  All reads and writes are performed using the QUORUM
> consistency level.
>
> Situation 1:
> Client A ("A") connects to Cassandra and requests a QUORUM consistency level
> get of an entire row.  At or very shortly thereafter (before A's request
> completes), Client B ("B") connects to Cassandra and inserts (or mutates) a
> column (or multiple columns) within the row.
>
> Does A receive the new data saved by B or does A receive the data prior to
> B's save?
>

Depends on the exact order of operations across several nodes.  Since
you can't know what that ordering will be (or what it was), you can't
predict whether you see the pre- or post-update version.

> Situaton 2:
> B connects and mutates multiple columns within a row.  A requests some data
> therein while B is processing.
>
> Result?
>

Which call was used to make the changes?

> Situation 3:
> B mutates multiple columns within multiple rows.  A requests some data
> therein while B is processing.
>
> Result?
>

Undefined, as in situation 1.

> Justification: At certain points I want to essentially lock a resource (row)
> in cassandra for exclusive write access (think checkout a resource) by
> setting a flag value of a column within that row.  I'm just considering race
> conditions.
>

If you really can't fix your design to avoid locks, then you need a
system to permit locking.  That usually means Zookeeper.


b

Mime
View raw message