Nicolas Favre-Felix created CASSANDRA-7537:
----------------------------------------------

             Summary: Updates and partition tombstones are not given the same 
timestamp in a CAS batch
                 Key: CASSANDRA-7537
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7537
             Project: Cassandra
          Issue Type: Bug
          Components: Core
            Reporter: Nicolas Favre-Felix


Create a table with one partition and 2 CQL rows:
{code}
CREATE TABLE t1 (
    k text,
    c text,
    v text,
    PRIMARY KEY(k,c)
);

BEGIN BATCH
    INSERT INTO t1 (k,c,v) VALUES ('x','1','1');
    INSERT INTO t1 (k,c,v) VALUES ('x','2','2');
APPLY BATCH;
{code}

CAS-delete the full partition based on the expected value of a single column:
{code}
cqlsh:ks1> SELECT * FROM t1 WHERE k='x';

 k | c | v
---+---+---
 x | 1 | 1
 x | 2 | 2

(2 rows)

cqlsh:ks1> BEGIN BATCH
       ...     UPDATE t1 SET v = '0' WHERE k = 'x' AND c = '1' IF v = '1';
       ...     DELETE FROM t1 WHERE k = 'x';
       ... APPLY BATCH;

 [applied]
-----------
      True

cqlsh:ks1> SELECT * FROM t1 WHERE k='x';

 k | c | v
---+---+---
 x | 1 | 0

(1 rows)
{code}

sstable2json reports that the updated column has a timestamp 1 greater than the 
partition delete:

{code}
{"key": "78","metadata": {"deletionInfo": 
{"markedForDeleteAt":1405097039224999,"localDeletionTime":1405097039}},"columns":
 [["1:v","0",1405097039225000]]}
{code}

All mutations in a CAS batch should be applied with the same timestamp.



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

Reply via email to