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

DOAN DuyHai commented on CASSANDRA-7400:
----------------------------------------

One improvement is that the timestamp can be generated server-side so 
statements are ordered. Anyway the client always has the possibility to add a 
custom timestamp for individual statements in the batch to guarantee order.

> BATCH with DELETE+INSERT on same partition key does not work
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-7400
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7400
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Robert Stupp
>         Attachments: BatchDeleteInsertTest.java
>
>
> If within a single batch the all rows for the whole partition key are deleted 
> and inserted again, the batch results with no rows inserted. See example 
> below and attached JUnit.
> {noformat}
> drop keyspace if exists junit;
> create keyspace junit WITH REPLICATION = { 'class' : 'SimpleStrategy', 
> 'replication_factor' : 2 };
> create table junit.tpc_base (
>     id int, cid int, val text, primary key ( ( id ), cid ) );
> {noformat}
> {noformat}
> begin batch
>     delete from junit.tpc_base where id = 11;
>     insert into junit.tpc_base (id, cid, val) values (11, 10, 'Ursus');
>     insert into junit.tpc_base (id, cid, val) values (11, 12, 'Lucky');
>     insert into junit.tpc_base (id, cid, val) values (11,  2, 'Sooke');
> apply batch;
> select * from junit.tpc_base;
> {noformat}
> --> *NO ROWS*
> {noformat}
> begin batch
>     delete from junit.tpc_base where id = 11;
> apply batch;
> begin batch
>     insert into junit.tpc_base (id, cid, val) values (11, 10, 'Ursus');
>     insert into junit.tpc_base (id, cid, val) values (11, 12, 'Lucky');
>     insert into junit.tpc_base (id, cid, val) values (11,  2, 'Sooke');
> apply batch;
> select * from junit.tpc_base;
> {noformat}
> --> 3 rows



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to