org.apache.cassandra.db.compaction

## Class CompactionController

- java.lang.Object
- - org.apache.cassandra.db.compaction.CompactionController

- All Implemented Interfaces:
    java.lang.AutoCloseable
  Direct Known Subclasses:
    SSTableSplitter.SplitController

      public class CompactionController
      extends java.lang.Object
      implements java.lang.AutoCloseable

  Manage compaction options.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `ColumnFamilyStore` | `cfs`
    `int` | `gcBefore`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CompactionController(ColumnFamilyStore cfs, int maxValue)`
    `` | `CompactionController(ColumnFamilyStore cfs, java.util.Set<SSTableReader> compacting, int gcBefore)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `java.lang.String` | `getColumnFamily()`
    `java.util.Set<SSTableReader>` | `getFullyExpiredSSTables()`
    `static java.util.Set<SSTableReader>` | `getFullyExpiredSSTables(ColumnFamilyStore cfStore, java.lang.Iterable<SSTableReader> compacting, java.lang.Iterable<SSTableReader> overlapping, int gcBefore)` Finds expired sstables works something like this; 1.
    `java.lang.String` | `getKeyspace()`
    `com.google.common.base.Predicate<java.lang.Long>` | `getPurgeEvaluator(DecoratedKey key)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### cfs

          public final ColumnFamilyStore cfs

    - #### gcBefore

          public final int gcBefore

  - ### Constructor Detail

    - #### CompactionController

          protected CompactionController(ColumnFamilyStore cfs,
                                         int maxValue)

    - #### CompactionController

          public CompactionController(ColumnFamilyStore cfs,
                                      java.util.Set<SSTableReader> compacting,
                                      int gcBefore)

  - ### Method Detail

    - #### getFullyExpiredSSTables

          public java.util.Set<SSTableReader> getFullyExpiredSSTables()

    - #### getFullyExpiredSSTables

          public static java.util.Set<SSTableReader> getFullyExpiredSSTables(ColumnFamilyStore cfStore,
                                                                             java.lang.Iterable<SSTableReader> compacting,
                                                                             java.lang.Iterable<SSTableReader> overlapping,
                                                                             int gcBefore)

      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` -
      Returns:

    - #### getKeyspace

          public java.lang.String getKeyspace()

    - #### getColumnFamily

          public java.lang.String getColumnFamily()

    - #### getPurgeEvaluator

          public com.google.common.base.Predicate<java.lang.Long> getPurgeEvaluator(DecoratedKey key)

      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()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`

Copyright © 2018 The Apache Software Foundation