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

update a row which was inserted with 'IF NOT EXISTS' key word will fail siently

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Not A Problem
    • 3.11.9
    • None
    • Low

    Description

      First, create keyspace and a table using the following

      CREATE KEYSPACE scheduler WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
      
      CREATE TABLE scheduler.job_info (
          id timeuuid PRIMARY KEY,
          create_time int,
          cur_retry int,
          cur_run_times int,
          expire_time int,
          max_retry int,
          max_run_times int,
          payload text,
          period int,
          retry_interval int,
          status tinyint,
          topic text,
          type text,
          update_time int
      ) with caching = {'keys':'ALL', 'rows_per_partition':'NONE'};
      

      then, execute the following cql:

      insert into job_info (id, create_time) values (5be224c6-8231-11e7-9619-9801b2a97471, 0) IF NOT EXISTS;
      insert into job_info (id, create_time) values (5be224c6-8231-11e7-9619-9801b2a97471, 1);
      select * from job_info;
      

      You will find that create_time is still 0, it is not updated.

      but, if you remove the IF NOT EXISTS keyword in the first cql, the update will success.

      Attachments

        Activity

          People

            Unassigned Unassigned
            myrfy001 mmh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: