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

CAS UPDATE for a lost race: save round trip by returning column values

    XMLWordPrintableJSON

Details

    Description

      Looking at the new CAS CQL3 support examples [1], if one lost a race for an UPDATE, to save a round trip to get the current values to decide if you need to perform your work, could the columns that were used in the IF clause also be returned to the caller? Maybe the columns values as part of the SET part could also be returned.

      I don't know if this is generally useful though.

      In the case of creating a new user account with a given username which is the partition key, if one lost the race to another person creating an account with the same username, it doesn't matter to the loser what the column values are, just that they lost.

      I'm new to Cassandra, so maybe there's other use cases, such as doing incremental amount of work on a row. In pure Java projects I've done while loops around AtomicReference.html#compareAndSet() until the work was done on the referenced object to handle multiple threads each making forward progress in updating the references object.

      [1] https://github.com/riptano/cassandra-dtest/blob/master/cql_tests.py#L3044

      Attachments

        1. 5619.txt
          112 kB
          Sylvain Lebresne
        2. 5619_thrift_fixup.txt
          141 kB
          Sylvain Lebresne
        3. 0001-Add-back-boolean-result-column.txt
          4 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            blair Blair Zajac
            Sylvain Lebresne
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: