[ 
https://issues.apache.org/jira/browse/CASSANDRA-8185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne resolved CASSANDRA-8185.
-----------------------------------------
    Resolution: Not a Problem

This is linked to CASSANDRA-6782. The change we made in CASSANDRA-6782 is not 
only related to TTL, it's that {{UPDATE}} does not "set" the value for the 
columns in the {{WHERE}} clause anymore. This does *not* mean that the primary 
key has no inherent value, only that {{UPDATE}} does not particularly set them 
(and after all those PK columns are not part of the {{SET}} clause). They will 
be "set" if you use {{INSERT}} however:
{noformat}
cqlsh:ks> CREATE TABLE TEST (key int PRIMARY KEY, s set<text>);
cqlsh:ks> INSERT INTO TEST (key, s) VALUES (1, { 'foo' });
cqlsh:ks> UPDATE TEST SET s = s - { 'foo' } WHERE key = 1;
cqlsh:ks> SELECT * FROM TEST;

 key | s
-----+------
   1 | null

(1 rows)
{noformat}
Long story short, use {{INSERT}} when you actually insert a row and {{UPDATE}} 
when updating it and you'll get the behavior you want. But if you use only 
{{UPDATE}} then a row will indeed disappear as soon as you've removed all 
non-PK values.


bq. the semantics of the UPDATE statement did change from 2.0.5 to 2.0.6

Yes it did but as can be seen in the comments of CASSANDRA-6782 there was a 
relatively strong consensus that the previous semantic was hurting enough than 
it was more a bug than anything else (mostly because of TTL which are not your 
own issue, granted, but changing the behavior only when there was TTL would 
have end up even more inconsistent in the end, and was not really feasible 
technically anyway). And so we fixed it. It certainly was not ideal that it was 
in a minor release but we made the call and now it's been changed for long 
enough that changing it back again for the sake of backward compatibility is 
not an option anymore.

bq. In 2.0.5, it would be possible for me to have a row in my table that 
contains a URL without any tags. When I upgrade to 2.0.6, this is no longer 
possible.

Just to re-iter what I said above, it *is* absolutely possible. Just use an 
{{INSERT}} to insert your URL.


> Removing the last item from a collection removes the entire row
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-8185
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8185
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: Mac OS X Yosemite
> JDK 8u25
>            Reporter: Stuart Gunter
>            Priority: Minor
>
> When removing the last item from a list or set (and I assume the same applies 
> to maps), the entire row is deleted rather than just that last item.
> I've only tested this in cases where the collection column is the only non-PK 
> column, but it is definitely a change between v2.0.5 and v2.0.6. I've looked 
> through the 2.0.6 release notes and issues and can't find any item that might 
> describe this, so I assume it's not an intended change. If such an issue 
> exists, I've probably just missed it, so apologies in advance.
> I've created a very simple project to reproduce the issue. If you clone the 
> repo and run it in two different modes (the README explains how to do this 
> with preconfigured Maven profiles), you will see the tests that pass on 
> v2.0.5 and fail on v2.0.6.
> Repo: https://github.com/stuartgunter/cassandra-2.0.6-bug



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

Reply via email to