[ https://issues.apache.org/jira/browse/CASSANDRA-13130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871754#comment-15871754 ]
Benjamin Lerer commented on CASSANDRA-13130: -------------------------------------------- bq. Could you please clarify what does "the higher value will win" mean? Sorry, I meant the {{greater}} value win. bq. Does it mean that it's not defined which of two updates will be actually applied? It is clearly defined which value will win. It might not just be the one that you expect. If you look at the following query: {{UPDATE t SET listColumn\[2\] = 8, listColumn\[2\] = 7 WHERE id = 1;}} You might expect that the second value will win because it comes last. In reality C* will consider that it has received 2 updates with exactly the same {{timestamp}}: {{UPDATE t SET listColumn\[2\] = 8 WHERE id = 1;}} and {{UPDATE t SET listColumn\[2\] = 7 WHERE id = 1;}} and will reconcile the data. The data will be reconciled 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. You will face the same issue with batches: {code} BEGIN BATCH UPDATE t SET listColumn[2] = 8 WHERE id = 1; UPDATE t SET listColumn[2] = 7 WHERE id = 1; APPLY BATCH; {code} will also result in {{listColumn=\{1,2,8,4\}}}. I you want the second update to always be the winner then you should send to separate updates. > Strange result of several list updates in a single request > ---------------------------------------------------------- > > Key: CASSANDRA-13130 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13130 > Project: Cassandra > Issue Type: Bug > Reporter: Mikhail Krupitskiy > Assignee: Benjamin Lerer > Priority: Trivial > > Let's assume that we have a row with the 'listColumn' column and value > \{1,2,3,4\}. > For me it looks logical to expect that the following two pieces of code will > ends up with the same result but it isn't so. > Code1: > {code} > UPDATE t SET listColumn[2] = 7, listColumn[2] = 8 WHERE id = 1; > {code} > Expected result: listColumn=\{1,2,8,4\} > Actual result: listColumn=\{1,2,7,8,4\} > Code2: > {code} > UPDATE t SET listColumn[2] = 7 WHERE id = 1; > UPDATE t SET listColumn[2] = 8 WHERE id = 1; > {code} > Expected result: listColumn=\{1,2,8,4\} > Actual result: listColumn=\{1,2,8,4\} > So the question is why Code1 and Code2 give different results? > Looks like Code1 should give the same result as Code2. -- This message was sent by Atlassian JIRA (v6.3.15#6346)