CompactionTask (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.db.compaction

## Class CompactionTask

- java.lang.Object
- - org.apache.cassandra.utils.WrappedRunnable
  - - 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, transaction`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompactionTask(ColumnFamilyStore cfs, LifecycleTransaction txn, int gcBefore, boolean offline)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `addToTotalBytesCompacted(long bytesCompacted)`
    `protected void` | `checkAvailableDiskSpace()`
    `protected int` | `executeInternal(CompactionManager.CompactionExecutorStatsCollector collector)`
    `CompactionAwareWriter` | `getCompactionAwareWriter(ColumnFamilyStore cfs, LifecycleTransaction transaction, java.util.Set<SSTableReader> nonExpiredSSTables)`
    `protected CompactionController` | `getCompactionController(java.util.Set<SSTableReader> toCompact)`
    `static SSTableFormat.Type` | `getFormatType(java.util.Collection<SSTableReader> sstables)`
    `protected int` | `getLevel()`
    `static long` | `getMaxDataAge(java.util.Collection<SSTableReader> sstables)`
    `static long` | `getMinRepairedAt(java.util.Set<SSTableReader> actuallyCompact)`
    `protected boolean` | `partialCompactionsAcceptable()`
    `boolean` | `reduceScopeForLimitedSpace(long expectedSize)`
    `protected void` | `runMayThrow()` For internal use and testing only.
    `static java.lang.String` | `updateCompactionHistory(java.lang.String keyspaceName, java.lang.String columnFamilyName, AbstractCompactionIterable ci, long startSize, long endSize)`

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

      `execute, setCompactionType, setUserDefined, toString`

    - ### 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,
                                LifecycleTransaction txn,
                                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`

    - #### reduceScopeForLimitedSpace

          public boolean reduceScopeForLimitedSpace(long expectedSize)

    - #### runMayThrow

          protected void runMayThrow()
                              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:
        `runMayThrow` in class `WrappedRunnable`
      Throws:
        `java.lang.Exception`

    - #### getCompactionAwareWriter

          public CompactionAwareWriter getCompactionAwareWriter(ColumnFamilyStore cfs,
                                                                LifecycleTransaction transaction,
                                                                java.util.Set<SSTableReader> nonExpiredSSTables)

      Specified by:
        `getCompactionAwareWriter` in class `AbstractCompactionTask`

    - #### updateCompactionHistory

          public static java.lang.String updateCompactionHistory(java.lang.String keyspaceName,
                                                                 java.lang.String columnFamilyName,
                                                                 AbstractCompactionIterable ci,
                                                                 long startSize,
                                                                 long endSize)

    - #### getMinRepairedAt

          public static long getMinRepairedAt(java.util.Set<SSTableReader> actuallyCompact)

    - #### checkAvailableDiskSpace

          protected void checkAvailableDiskSpace()

    - #### getLevel

          protected int getLevel()

    - #### getCompactionController

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

    - #### partialCompactionsAcceptable

          protected boolean partialCompactionsAcceptable()

    - #### getMaxDataAge

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

    - #### getFormatType

          public static SSTableFormat.Type getFormatType(java.util.Collection<SSTableReader> sstables)

Copyright © 2018 The Apache Software Foundation