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

DELETE after INSERT IF NOT EXISTS does not work

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      DELETE a row immediately after INSERT IF NOT EXISTS does not work.

      Can be reproduced with this CQL script:

      CREATE KEYSPACE ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
      CREATE TABLE ks.ta ( id text PRIMARY KEY, col text );
      INSERT INTO ks.ta (id, col) VALUES ('myId', 'myCol') IF NOT EXISTS;
      DELETE FROM ks.ta WHERE id = 'myId';
      SELECT * FROM ks.ta WHERE id='myId';
      
      [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
      Use HELP for help.
      WARNING: pyreadline dependency missing.  Install to enable tab completion.
      cqlsh> CREATE KEYSPACE ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
      cqlsh> CREATE TABLE ks.ta ( id text PRIMARY KEY, col text );
      cqlsh> INSERT INTO ks.ta (id, col) VALUES ('myId', 'myCol') IF NOT EXISTS;
      
       [applied]
      -----------
            True
      
      cqlsh> DELETE FROM ks.ta WHERE id = 'myId';
      cqlsh> SELECT * FROM ks.ta WHERE id='myId';
      
       id   | col
      ------+-------
       myId | myCol
      
      • Only happens if the client is on a different host (works as expected on the same host)
      • Works as expected without IF NOT EXISTS
      • A ~500 ms delay between INSERT and DELETE fixes the issue.

      Logs attached.

        Attachments

        1. debug.log
          1.19 MB
          Julien
        2. system.log
          43 kB
          Julien

          Issue Links

            Activity

              People

              • Assignee:
                vinaykumarcse Vinay Chella
                Reporter:
                Julien Moreau Genesys Julien
              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: