[
https://issues.apache.org/jira/browse/CASSANDRA-7400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brandon Williams resolved CASSANDRA-7400.
-----------------------------------------
Resolution: Not a Problem
See CASSANDRA-6625. The crux of the problem is the batch is using the same
timestamp, and deletes win on a tie.
> 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)