I too am interested in a CAS facility.
I like Rishi's proposal. One could simply use a version number as the logical timestamp. If we promote CAS to a consistency level, it would rate higher than a quorum. One pays the price for a more complex write path to obtain the requisite guarantee.
On Jun 21, 2010, at 4:03 AM, Rishi Bhardwaj wrote:
Heres another thought I had, if say the user always wrote with quorum (or to all) nodes then can't we implement CAS (compare and swap) assuming that user employs logical timestamp and Cassandra doesn't allow writes to a column with same or older timestamp. Here's the scenario I am thinking about: Say we use logical timestamp for a column value and lets assume the current timestamp is t. Now say two clients read this column and generate concurrent CAS (compare and swap) operations on timestamp t and for both the writes the resulting new timestamp would become (t +1). Now if we don't allow writes to a column with same timestamp then only one of these writes would succeed. Of course another assumption is that if a third CAS write with compare on logical timestamp (t - 1) came in, that would be denied as I believe Cassandra doesn't allow "older" writes to win over "newer" writes. Do you think such a thing can be accomplished?