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

Benjamin Lerer commented on CASSANDRA-13203:
--------------------------------------------

One important stuff to understand here is that C* use timestamp to determine 
what is the latest modification.
By consequence, if you send an update with the same timestamp, C* does not know 
which one is the latest modification and will try to reconcile the data as 
follow:
# if one of the modifications is a deletion (tomstone), it wins and the data is 
marked as deleted
# if none of the modifications is a deletion, the update with the greater value 
win. If {{A > B}} then A win. If {{B > A}} then B win.

If your list was {{frozen}}, the list with the greater value will win. Due to 
that it will have been possible that you update had no effect.

As your list are not frozen the situation is even worst.
C* has to deleted the cells of the existing list before inserting the new ones. 
As a deletion (tombstone) is always the winner C* cannot insert the cells with 
the same timestamp than the one used to deleted them. To avoid that problem, C* 
delete the list elements using {{timestamp - 1}} and insert them using 
{{timestamp}}.

As your original data has been inserted with the same timestamp than your 
update, the deletion as no effect on the original data (as the deletion 
timestamp is earlier than the one of the original data) and only the second 
insertion is taken into account.

Updating data with the same timestamp than the one of the existing data is 
simply something that you should not do with C*.

Unfortunatly, there are currently noway to make the unfrozen lists behave as 
the frozen ones in this specific scenario.  
  
 

 

> UPDATE USING TIMESTAMP can surprisingly append to a list column instead of 
> replace
> ----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13203
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13203
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: craig mcmillan
>            Assignee: Benjamin Lerer
>            Priority: Minor
>
> {code}
> create table stufflist (id uuid primary key , stuff list<text>);
> insert into stufflist (id, stuff) values 
> (75a01c40-eed9-11e6-930a-939ae9ea5575, ['one']) using timestamp 1000;
> update stufflist using timestamp 1000 set stuff=['one'] where 
> id=75a01c40-eed9-11e6-930a-939ae9ea5575;
> select * from stufflist;
>  id                                   | stuff
> --------------------------------------+----------------
>  75a01c40-eed9-11e6-930a-939ae9ea5575 | ['one', 'one']
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to