Class CompactionController

java.lang.Object
org.apache.cassandra.db.AbstractCompactionController
org.apache.cassandra.db.compaction.CompactionController
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
SortedTableVerifier.VerifyController, SSTableSplitter.SplitController, TimeWindowCompactionController

public class CompactionController extends AbstractCompactionController
Manage compaction options.
  • Constructor Details

  • Method Details

    • maybeRefreshOverlaps

      public void maybeRefreshOverlaps()
    • getFullyExpiredSSTables

      public Set<SSTableReader> getFullyExpiredSSTables()
    • getFullyExpiredSSTables

      public static Set<SSTableReader> getFullyExpiredSSTables(ColumnFamilyStore cfStore, Iterable<SSTableReader> compacting, Iterable<SSTableReader> overlapping, long gcBefore, boolean ignoreOverlaps)
      Finds expired sstables works something like this; 1. find "global" minTimestamp of overlapping sstables, compacting sstables and memtables containing any non-expired data 2. build a list of fully expired candidates 3. check if the candidates to be dropped actually can be dropped (maxTimestamp < global minTimestamp) - if not droppable, remove from candidates 4. return candidates.
      Parameters:
      cfStore -
      compacting - we take the drop-candidates from this set, it is usually the sstables included in the compaction
      overlapping - the sstables that overlap the ones in compacting.
      gcBefore -
      ignoreOverlaps - don't check if data shadows/overlaps any data in other sstables
      Returns:
    • getFullyExpiredSSTables

      public static Set<SSTableReader> getFullyExpiredSSTables(ColumnFamilyStore cfStore, Iterable<SSTableReader> compacting, Iterable<SSTableReader> overlapping, long gcBefore)
    • getPurgeEvaluator

      public LongPredicate getPurgeEvaluator(DecoratedKey key)
      Specified by:
      getPurgeEvaluator in class AbstractCompactionController
      Parameters:
      key -
      Returns:
      a predicate for whether tombstones marked for deletion at the given time for the given partition are purgeable; we calculate this by checking whether the deletion time is less than the min timestamp of all SSTables containing his partition and not participating in the compaction. This means there isn't any data in those sstables that might still need to be suppressed by a tombstone at this timestamp.
    • close

      public void close()
    • compactingRepaired

      public boolean compactingRepaired()
      Specified by:
      compactingRepaired in class AbstractCompactionController
    • shadowSources

      public Iterable<UnfilteredRowIterator> shadowSources(DecoratedKey key, boolean tombstoneOnly)
      Overrides:
      shadowSources in class AbstractCompactionController
    • ignoreOverlaps

      protected boolean ignoreOverlaps()
      Is overlapped sstables ignored Control whether or not we are taking into account overlapping sstables when looking for fully expired sstables. In order to reduce the amount of work needed, we look for sstables that can be dropped instead of compacted. As a safeguard mechanism, for each time range of data in a sstable, we are checking globally to see if all data of this time range is fully expired before considering to drop the sstable. This strategy can retain for a long time a lot of sstables on disk (see CASSANDRA-13418) so this option control whether or not this check should be ignored. Do NOT call this method in the CompactionController constructor
      Returns:
      false by default