You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Mark Kerzner <ma...@gmail.com> on 2011/05/16 22:51:21 UTC

Cassandra and concurrent programming

Hi, guys,

what happens if I have two threads or two processes, both of which need to
ask if some condition in Cassandra is fulfilled, and then, say, write the
data based on that. If one receives the "no" answer and decides to write,
but before he does, the other one receives the "no" answer and writes first,
then the action of the first one is based on the wrong assumption.

In threading, you would do an atomic "put if not present," is there such a
thing in Cassandra?

Thank you,
Mark

Re: Cassandra and concurrent programming

Posted by Mark Kerzner <ma...@gmail.com>.
Thank you for a quick answer - I could impress my colleagues at the meeting
:)

On Mon, May 16, 2011 at 2:54 PM, Peter Schuller <peter.schuller@infidyne.com
> wrote:

> > In threading, you would do an atomic "put if not present," is there such
> a
> > thing in Cassandra?
>
> No. In general, one works to avoid the need for strong co-ordination.
> If strong co-ordination is truly required, some external method is
> required. Some people use ZooKeeper (http://zookeeper.apache.org/) for
> that.
>
> --
> / Peter Schuller
>

Re: Cassandra and concurrent programming

Posted by Peter Schuller <pe...@infidyne.com>.
> In threading, you would do an atomic "put if not present," is there such a
> thing in Cassandra?

No. In general, one works to avoid the need for strong co-ordination.
If strong co-ordination is truly required, some external method is
required. Some people use ZooKeeper (http://zookeeper.apache.org/) for
that.

-- 
/ Peter Schuller