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

Make TokenMetadata's ring version increments atomic

    XMLWordPrintableJSON

    Details

    • Bug Category:
      Correctness - Recoverable Corruption / Loss
    • Severity:
      Normal
    • Complexity:
      Normal
    • Discovered By:
      Code Inspection
    • Platform:
      All
    • Impacts:
      None
    • Since Version:
    • Test and Documentation Plan:
      Hide

      The patch adds a test that would be almost guaranteed to fail if the ring invalidation ever became unsafe.

      Show
      The patch adds a test that would be almost guaranteed to fail if the ring invalidation ever became unsafe.

      Description

      The update semantics of the ring version in TokenMetadata are not clear. The instance variable itself is volatile, but it is still incremented by a non-atomic check-and-set, and not all codepaths do that while holding the TokenMetadata write lock. We could make this more intelligible by forcing the external callers to use both the write when invalidating the ring and read lock when reading the current ring version. Most of the readers of the ring version (ex. compaction) don't need it to be fast, but it shouldn't be a problem even if they do. If we do this, we should be able to avoid a situation where concurrent invalidations don't produce two distinct version increments.

        Attachments

          Activity

            People

            • Assignee:
              maedhroz Caleb Rackliffe
              Reporter:
              maedhroz Caleb Rackliffe
              Authors:
              Caleb Rackliffe
              Reviewers:
              Andres de la Peña, Yifan Cai
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m