[
https://issues.apache.org/jira/browse/CASSANDRA-11368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032446#comment-17032446
]
Russell Spitzer commented on CASSANDRA-11368:
---------------------------------------------
This is a combination of batch behavior and collection behavior conflicting.
Batches give all mutations in the batch the same timestamp. List appends work
by doing a tombstone at t-1 from the append.
This means this code
{code}
BEGIN BATCH
insert into test_1(id, vector, version) values ('3', [0.1, 0.2], 0)
insert into test_1(id, vector, version) values ('3', [0.1, 0.2], 0)
APPLY BATCH;
{code}
Translates to
{code}
t-1 -- Delete
t-1 -- Delete
t -- Insert
t -- Insert
{code}
So you end up with the same element twice because what the collection api was
expecting was something more along the lines of
{code}
t - 3 -- Delete
t - 2 -- Insert
t - 1 -- Delete
t - 0 -- Insert
{code}
For more info check out
https://datastax-oss.atlassian.net/browse/SPARKC-545 where we looked into this
issue
> Lists inserts are not truly idempotent
> --------------------------------------
>
> Key: CASSANDRA-11368
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11368
> Project: Cassandra
> Issue Type: Bug
> Components: Legacy/Core
> Reporter: Thanh
> Priority: Normal
>
> List of UDT can't be updated properly when using USING TIMESTAMP
> Observe:
> {code}
> cqlsh:t360> CREATE TYPE fullname (
> ... fname text,
> ... lname text
> ... );
> cqlsh:t360> CREATE TABLE users (
> ... id text PRIMARY KEY,
> ... names list<frozen <fullname>>,
> ... phone text
> ... );
> cqlsh:t360> UPDATE users USING TIMESTAMP 1458019725701 SET names = [{ fname:
> 'fname1', lname: 'lname1'},{ fname: 'fname2', lname: 'lname2'},{ fname:
> 'fname3', lname: 'lname3'}] WHERE id='a';
> cqlsh:t360> select * from users;
> id | names | phone
> ----+--------------------------------------------------------------------------------------------------------------+-------
>
> a | [{lname: 'lname1', fname: 'fname1'}, {lname: 'lname2', fname: 'fname2'},
> {lname: 'lname3', fname: 'fname3'}] | null
> (1 rows)
> cqlsh:t360> UPDATE users USING TIMESTAMP 1458019725701 SET names = [{ fname:
> 'fname1', lname: 'lname1'},{ fname: 'fname2', lname: 'lname2'},{ fname:
> 'fname3', lname: 'lname3'}] WHERE id='a';
> cqlsh:t360> select * from users;
> id | names | phone
> ----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------
>
> a | [{lname: 'lname1', fname: 'fname1'}, {lname: 'lname2', fname: 'fname2'},
> {lname: 'lname3', fname: 'fname3'}, {lname: 'lname1', fname: 'fname1'},
> {lname: 'lname2', fname: 'fname2'}, {lname: 'lname3', fname: 'fname3'}] | null
> (1 rows)
> {code}
> => the list doesn't get replaced, it gets appended, which is not the
> expected/desired result
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]