CompactionTask (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.db.compaction

## Class CompactionTask

- java.lang.Object
- - org.apache.cassandra.utils.WrappedRunnable
  - - org.apache.cassandra.io.util.DiskAwareRunnable
    - - org.apache.cassandra.db.compaction.AbstractCompactionTask
      - - org.apache.cassandra.db.compaction.CompactionTask

- All Implemented Interfaces:
    java.lang.Runnable
  Direct Known Subclasses:
    LeveledCompactionTask, SSTableSplitter.SplittingCompactionTask

      public class CompactionTask
      extends AbstractCompactionTask

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `gcBefore`
    `protected static org.slf4j.Logger` | `logger`
    `protected static long` | `totalBytesCompacted`

    - ### Fields inherited from class org.apache.cassandra.db.compaction.AbstractCompactionTask

      `cfs, compactionType, isUserDefined, sstables`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompactionTask(ColumnFamilyStore cfs, java.lang.Iterable<SSTableReader> sstables, int gcBefore, boolean offline)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `addToTotalBytesCompacted(long bytesCompacted)`
    `protected int` | `executeInternal(CompactionManager.CompactionExecutorStatsCollector collector)`
    `protected CompactionController` | `getCompactionController(java.util.Set<SSTableReader> toCompact)`
    `long` | `getExpectedWriteSize()` Get expected write size to determine which disk to use for this task.
    `protected int` | `getLevel()`
    `static long` | `getMaxDataAge(java.util.Collection<SSTableReader> sstables)`
    `protected boolean` | `newSSTableSegmentThresholdReached(SSTableWriter writer)`
    `protected boolean` | `partialCompactionsAcceptable()`
    `boolean` | `reduceScopeForLimitedSpace()` Called if no disk is available with free space for the full write size.
    `protected void` | `runWith(java.io.File sstableDirectory)` For internal use and testing only.

    - ### Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionTask

      `execute, getDirectories, setCompactionType, setUserDefined, toString`

    - ### Methods inherited from class org.apache.cassandra.io.util.DiskAwareRunnable

      `runMayThrow`

    - ### Methods inherited from class org.apache.cassandra.utils.WrappedRunnable

      `run`

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

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

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

    - #### gcBefore

          protected final int gcBefore

    - #### totalBytesCompacted

          protected static long totalBytesCompacted

  - ### Constructor Detail

    - #### CompactionTask

          public CompactionTask(ColumnFamilyStore cfs,
                        java.lang.Iterable<SSTableReader> sstables,
                        int gcBefore,
                        boolean offline)

  - ### Method Detail

    - #### addToTotalBytesCompacted

          public static long addToTotalBytesCompacted(long bytesCompacted)

    - #### executeInternal

          protected int executeInternal(CompactionManager.CompactionExecutorStatsCollector collector)

      Specified by:
        `executeInternal` in class `AbstractCompactionTask`

    - #### getExpectedWriteSize

          public long getExpectedWriteSize()

      Description copied from class: `DiskAwareRunnable`
      Get expected write size to determine which disk to use for this task.
      Specified by:
        `getExpectedWriteSize` in class `DiskAwareRunnable`
      Returns:
        expected size in bytes this task will write to disk.

    - #### reduceScopeForLimitedSpace

          public boolean reduceScopeForLimitedSpace()

      Description copied from class: `DiskAwareRunnable`
      Called if no disk is available with free space for the full write size.
      Overrides:
        `reduceScopeForLimitedSpace` in class `DiskAwareRunnable`
      Returns:
        true if the scope of the task was successfully reduced.

    - #### runWith

          protected void runWith(java.io.File sstableDirectory)
                          throws java.lang.Exception

      For internal use and testing only. The rest of the system should go through the submit* methods, which are properly serialized. Caller is in charge of marking/unmarking the sstables as compacting.
      Specified by:
        `runWith` in class `DiskAwareRunnable`
      Parameters:
        `sstableDirectory` - sstable directory to work on
      Throws:
        `java.lang.Exception`

    - #### getLevel

          protected int getLevel()

    - #### getCompactionController

          protected CompactionController getCompactionController(java.util.Set<SSTableReader> toCompact)

    - #### partialCompactionsAcceptable

          protected boolean partialCompactionsAcceptable()

    - #### newSSTableSegmentThresholdReached

          protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer)

    - #### getMaxDataAge

          public static long getMaxDataAge(java.util.Collection<SSTableReader> sstables)

Copyright © 2014 The Apache Software Foundation