incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: Mixing CAS UPDATE and non-CAS DELETE
Date Wed, 26 Jun 2013 17:26:33 GMT
On Tue, Jun 25, 2013 at 5:30 AM, Blair Zajac <blair@orcaware.com> wrote:

> But if I want to delete it regardless of v1, then this doesn't work:
>
>   DELETE FROM test WHERE k = 0 IF EXISTS
>

That's correct, though we should probably fix that at some point. I've
opened https://issues.apache.org/jira/browse/CASSANDRA-5708 for that.


> So one is left to
>
>   DELETE FROM test WHERE k = 0
>
> How does this non-CAS DELETE mix with a CAS UPDATE for the same partition
> key?  Will they properly not step over each other?
>

Depends on what you mean by "not step over each other". A CAS update will
end up inserting columns with a timestamp that is basically the one of the
start of the paxos algorithm use underneath. The delete itself will be a
tombstone with a timestamp of when you execute that delete. So the basic
rule of "the more recent wins" will apply. Of course if 2 such operations
contend, you can't really know which will win. But if you do a delete at
QUORUM, followed by a CAS update IF NOT EXISTS (and there is no other
concurrently running operation on that row) you are guaranteed that your
update will succeed.

I don't know if I've answered your question.

--
Sylvain



>
> Thanks,
> Blair
>
> [1] https://github.com/riptano/**cassandra-dtest/blob/master/**
> cql_tests.py#L3044<https://github.com/riptano/cassandra-dtest/blob/master/cql_tests.py#L3044>
>

Mime
View raw message