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

Preemptive opening of compaction result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.1 beta2
    • None
    • Low

    Description

      Related to CASSANDRA-6812, but a little simpler: when compacting, we mess quite badly with the page cache. One thing we can do to mitigate this problem is to use the sstable we're writing before we've finished writing it, and to drop the regions from the old sstables from the page cache as soon as the new sstables have them (even if they're only written to the page cache). This should minimise any page cache churn, as the old sstables must be larger than the new sstable, and since both will be in memory, dropping the old sstables is at least as good as dropping the new.

      The approach is quite straight-forward. Every X MB written:

      1. grab flushed length of index file;
      2. grab second to last index summary record, after excluding those that point to positions after the flushed length;
      3. open index file, and check that our last record doesn't occur outside of the flushed length of the data file (pretty unlikely)
      4. Open the sstable with the calculated upper bound

      Some complications:

      1. must keep running copy of compression metadata for reopening with
      2. we need to be able to replace an sstable with itself but a different lower bound
      3. we need to drop the old page cache only when readers have finished

      Attachments

        1. 6916.fix.txt
          1 kB
          Benedict Elliott Smith
        2. 6916.fix2.txt
          8 kB
          Benedict Elliott Smith
        3. 6916.fixup.txt
          4 kB
          Benedict Elliott Smith
        4. 6916-stock2_1.mixed.cache_tweaks.tar.gz
          45 kB
          Ryan McGuire
        5. 6916-stock2_1.mixed.logs.tar.gz
          44 kB
          Ryan McGuire
        6. 6916v3-preempive-open-compact.logs.gz
          40 kB
          Ryan McGuire
        7. 6916v3-preempive-open-compact.mixed.2.logs.tar.gz
          42 kB
          Ryan McGuire
        8. 6916v3-premptive-open-compact.mixed.cache_tweaks.2.tar.gz
          47 kB
          Ryan McGuire

        Issue Links

          Activity

            People

              benedict Benedict Elliott Smith
              benedict Benedict Elliott Smith
              Benedict Elliott Smith
              Marcus Eriksson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: