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

Incorrect condition causes cleanup of SSTables which might not need it

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.1.12, 2.2.4, 3.0.1, 3.1
    • None
    • None
    • Normal

    Description

      We needed to perform cleanup of SSTables in our production cluster but found out that it would take several months. Together with my colleague JiriHorky we have pinpointed the issue to method CompactionManager.needsCleanup which incorrectly marks almost all SSTables as the ones needing the cleanup even though that might not be true. I am attaching a patch which should be applicable from version 2.x forward (this is the version we would need it in).

      To explain the problem, the last condition in the cycle that checks whether the next key in the SSTable after the current checked range is NOT contained in the next range falsely marks SSTable as necessary to have cleanup even though it might be contained in some other range. The correct condition (which is actully described in the comment) is to check whether the next key in the SSTable after the current range is less than or equal to the "left" key of the next range (assuming that the left key is exclusive which is described in another comment of the same method).

      Is our patch and reasoning correct?

      Attachments

        1. trunk-10740.txt
          1 kB
          Jakub Janecek
        2. trunk-test-10740.txt
          7 kB
          Jakub Janecek

        Activity

          People

            jakubjanecek Jakub Janecek
            jakubjanecek Jakub Janecek
            Jakub Janecek
            Marcus Eriksson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: