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

    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.util.Set<SSTableReader> compacting, java.util.Set<SSTableReader> overlapping, int gcBefore)` Finds expired sstables works something like this; 1.
    `java.lang.String` | `getKeyspace()`
    `void` | `invalidateCachedRow(DecoratedKey key)`
    `long` | `maxPurgeableTimestamp(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.util.Set<SSTableReader> compacting,
                                                             java.util.Set<SSTableReader> overlapping,
                                                             int gcBefore)

      Finds expired sstables works something like this; 1. find "global" minTimestamp of overlapping sstables (excluding the possibly droppable ones) 2. build a list of candidates to be dropped 3. sort the candidate list, biggest maxTimestamp first in list 4. check if the candidates to be dropped actually can be dropped (maxTimestamp < global minTimestamp) and it is included in the compaction - if not droppable, update global minTimestamp and remove from candidates 5. 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()

    - #### maxPurgeableTimestamp

          public long maxPurgeableTimestamp(DecoratedKey key)

      Returns:
        the largest timestamp before which it's okay to drop tombstones for the given partition; i.e., after the maxPurgeableTimestamp there may exist newer data that still needs to be suppressed in other sstables. This returns the minimum timestamp for any SSTable that contains this partition and is not participating in this compaction, or LONG.MAX_VALUE if no such SSTable exists.

    - #### invalidateCachedRow

          public void invalidateCachedRow(DecoratedKey key)

    - #### close

          public void close()

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

Copyright © 2014 The Apache Software Foundation