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

Potential concurrency issue with CDC size calculation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Invalid
    • None
    • None
    • None
    • Normal

    Description

      We're backporting CDC feature and bug fixes to 3.0. There is potential visibility issue with two variables CDCSizeTracker.sizeInProgress and DirectorySizeCalculator.size . They're declared as volatile however there are cases that when assigning new values to them, the new values depend on the current value. For example:
      https://github.com/apache/cassandra/blob/e9da85723a8dd40872c4bca087a03b655bd2cacb/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java#L285
      https://github.com/apache/cassandra/blob/e9da85723a8dd40872c4bca087a03b655bd2cacb/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java#L297

      In rare cases we'll not be able to calculate CDC data size correctly. We should change these two variables back to AtomicLong, as the simplest fix. Java Concurrency In Practice section 3.1.3 explains well why we shouldn't use volatile in these two cases. I'll provide patch shortly.

      cc JoshuaMcKenzie jay.zhuang

      Attachments

        Activity

          People

            szhou Simon Zhou
            szhou Simon Zhou
            Simon Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: