cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-5715) CAS on 'primary key only' table
Date Thu, 11 Jul 2013 15:13:51 GMT


Jonathan Ellis commented on CASSANDRA-5715:

I don't think I'm convinced ... I consider it "good CQL style" to use INSERT when we expect
to be creating a new row, and UPDATE when we expect to alter an existing one, even if the
database doesn't read-before-write to enforce this.  Making this explicit for CAS feels like
a Good Thing to me.  And since the syntax differs anyway for IF NOT EXISTS and IF X=Y, forcing
a high level API to use the rest of INSERT or UPDATE syntax doesn't feel like it makes their
lives much harder.

But, I'm open to making them fully symmetrical down the road if it turns out I'm wrong.  We
don't have the option to "fix our mistake" later if we start out with all syntax supported.
> CAS on 'primary key only' table
> -------------------------------
>                 Key: CASSANDRA-5715
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.0
>         Attachments: 0001-Conditions-on-INSERT.txt, 0002-Support-updating-the-PK-only.txt
> Given a table with only a primary key, like
> {noformat}
> {noformat}
> there is currently no way to CAS a row in that table into existing because:
> # INSERT doesn't currently support IF
> # UPDATE has no way to update such table
> So we should probably allow IF conditions on INSERT statements.
> In addition (or alternatively), we could work on allowing UPDATE to update such table.
One motivation for that could be to make UPDATE always be more general to INSERT. That is
currently, there is a bunch of operation that INSERT cannot do (counter increments, collection
appends), but that "primary key table" case is, afaik, the only case where you *need* to use
INSERT. However, because CQL forces segregation of PK value to the WHERE clause and not to
the SET one, the only syntax that I can see work would be:
> {noformat}
> {noformat}
> which maybe is too ugly to allow?

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:

View raw message