cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-12691) LWT: Inserting Subset of columns returns all columns
Date Fri, 23 Sep 2016 07:24:22 GMT

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

Sylvain Lebresne commented on CASSANDRA-12691:
----------------------------------------------

I'm not really sure I agree we should make this change and this is definitively working as
designed. What we return on a LWT failure is the data that correspond to the condition not
applying. In this case, the condition is {{IF NOT EXISTS}}, which means no row should exist.
The condition is not limited to the columns inserted in particular. So returning the full
row that does exist and make the condition fail feels somewhat more "logical" to me.

Don't get me wrong, I'm not saying returning only the inserted columns would be a completely
wrong semantic either. But for every user that would be fine with only getting the inserting
columns back in this case, there is probably a user for which getting the full row is actually
useful, so I think the current behavior is both slightly more consistent (as justified above)
and more useful. Lastly, and as importantly, changing this now would be a breaking change
for anyone that rely on it, which is the main reason why I'm going to close this. Meaning
that we don't break backward compatibility unless we have strong evidence that the existence
behavior is genuinely problematic and I can't see any here (but feel free to re-open if you
have some).

As an aside, I'll note that we kind of have to query all columns internally to validate the
{{IF NOT EXISTS}} condition anyway, so returning only a subset of the columns wouldn't even
buy much in term of performance of the query.

Lastly, I'm going to assume that you made a typo in your description when you said "Actual
result: Returns true" since it should obviously return false.

> LWT: Inserting Subset of columns returns all columns
> ----------------------------------------------------
>
>                 Key: CASSANDRA-12691
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12691
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>         Environment: 3.x
>            Reporter: Highstead
>            Priority: Minor
>              Labels: transaction, transactions
>
> See: https://github.com/gocql/gocql/issues/792#issuecomment-248983669
> When inserting a subset of the table columns with the use of light weight transactions
the cassandra result returns a full set of unordered cassandra column values.  
> SETUP:
> {code}
> CREATE TABLE IF NOT EXISTS test.inserttest(
>     key bigint,
>     session_token text,
>     foo text, 
>     bar text,
> PRIMARY KEY(key, event_date, session_token);
> INSERT INTO test.inserttest(key, session_token, foo) VALUES (1, 'myToken', 'baz') IF
NOT EXISTS;
> {code}
> {code}insert into test.inserttest(key, session_token, foo) VALUES (1, 'myToken', 'bez')
IF NOT EXISTS;{code}
> Expected result: Returns False, 1, myToken, baz
> Actual result: Returns true and all column values.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message