cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-5062) Support CAS
Date Thu, 28 Feb 2013 17:17:15 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-5062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13589676#comment-13589676
] 

Jonathan Ellis commented on CASSANDRA-5062:
-------------------------------------------

I'm working on a sketch of this approach.

{code}
.   public static boolean cas(ByteBuffer key, ColumnFamily expected, ColumnFamily updates)
    {
        // read existing row

        // compare current value with expected
        if (expected does not match current)
            return false;

        // apply the update!

    }
{code}

I'm adding an optional "[time]UUID paxosBallot" to RowMutation for the proposal IDs.  The
updates to RMVH and callbacks should be pretty straightforward.  I think Sylvain talked me
into using a system CF instead of a flat file to hold uncommitted proposals.

The "read" here must be paxos-aware to prevent our lost-ack problem: it must return both committed
value and the highest accepted proposal.  Making read/resolve paxos-aware is going to be the
messy part.

Since we need it for CAS anyway, I think we should also expose this read path as {{ConsistencyLevel.SERIAL}}
or similar.

Starting with Thrift because "boolean cas(...)" is straightforward.  What syntax do we use
to expose this to CQL?  A WHERE clause to UPDATE means something different in SQL and would
IMO be too confusing.
                
> Support CAS
> -----------
>
>                 Key: CASSANDRA-5062
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5062
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API, Core
>            Reporter: Jonathan Ellis
>             Fix For: 2.0
>
>
> "Strong" consistency is not enough to prevent race conditions.  The classic example is
user account creation: we want to ensure usernames are unique, so we only want to signal account
creation success if nobody else has created the account yet.  But naive read-then-write allows
clients to race and both think they have a green light to create.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message