Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-7537

Updates and partition tombstones are not given the same timestamp in a CAS batch

    XMLWordPrintableJSON

Details

    • Normal

    Description

      Create a table with one partition and 2 CQL rows:

      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;
      

      CAS-delete the full partition based on the expected value of a single column:

      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)
      

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

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

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            nff Nicolas Favre-Felix
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: