You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Robert Stupp (JIRA)" <ji...@apache.org> on 2014/06/15 20:27:01 UTC

[jira] [Created] (CASSANDRA-7400) BATCH with DELETE+INSERT on same partition key does not work

Robert Stupp created CASSANDRA-7400:
---------------------------------------

             Summary: 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)