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

Deleting from an empty list produces an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.1.6
    • Legacy/CQL
    • None
    • Low

    Description

      While deleting an element from a list that does not contain it is a no-op, deleting it from an empty list causes an error.
      This edge case is a bit inconsistent, because it makes list deletion non idempotent:

      cqlsh:test> create table foo (k int primary key, v list<int>);
      cqlsh:test> insert into foo(k,v) values (1, [1,2]);
      
      cqlsh:test> update foo set v = v - [1] where k = 1;
      cqlsh:test> update foo set v = v - [1] where k = 1;
      
      cqlsh:test> update foo set v = v - [2] where k = 1;
      cqlsh:test> update foo set v = v - [2] where k = 1;
      InvalidRequest: code=2200 [Invalid query] message="Attempted to delete an element from a list which is null"
      

      With speculative retries coming to the drivers, idempotency becomes more important because it determines which query we might retry or not. So it would be better if deleting from an empty list succeeded.

      Attachments

        1. 9198.txt
          2 kB
          Jeff Jirsa
        2. 9198-v2-2.1.txt
          5 kB
          Jeff Jirsa
        3. 9198-v2-trunk.txt
          5 kB
          Jeff Jirsa

        Activity

          People

            jjirsa Jeff Jirsa
            omichallat Olivier Michallat
            Jeff Jirsa
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: