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

Failed Compare and Swap in SASI's DataTracker#update Can Lead to Improper Reference Counting of SSTableIndex

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Normal
    • Resolution: Unresolved
    • None
    • Feature/SASI
    • None
    • Normal

    Description

      A race between e.g. index redistribution and compaction (or memtable flushes and compaction) can cause the compare and swap of a new sasi.conf.View in sasi.conf.DataTracker#update to fail, leading to recreation of the view and improper reference counting of an SSTableIndex. This is because the side-effects (decrementing the reference count via SStableIndex#release) occur regardless of if the view is promoted to be the active view.  

      Code: https://github.com/apache/cassandra/blob/cassandra-3.11.1/src/java/org/apache/cassandra/index/sasi/conf/DataTracker.java#L72-L78 

      Attached logs and debug output show case where index redistribution and compaction race. This case was generated using the test provided in https://issues.apache.org/jira/browse/CASSANDRA-14055

      Attachments

        1. 14207-example-test.patch
          8 kB
          Jordan West
        2. sasi-invalid-reference-count.rtf
          8 kB
          Jordan West

        Activity

          People

            jwest Jordan West
            jwest Jordan West
            Jordan West
            Dinesh Joshi
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: