## org.apache.cassandra.db.compaction
Class CompactionTask

    java.lang.Object
      org.apache.cassandra.db.compaction.AbstractCompactionTask
          org.apache.cassandra.db.compaction.CompactionTask

Direct Known Subclasses:
  LeveledCompactionTask

    public class CompactionTask

extends AbstractCompactionTask

Field Summary
`protected OperationType` `compactionType`
`protected int` `gcBefore`
`protected boolean` `isUserDefined`
`protected static org.slf4j.Logger` `logger`
`protected static long` `totalBytesCompacted`

Fields inherited from class org.apache.cassandra.db.compaction.AbstractCompactionTask
`cfs, sstables`

Constructor Summary
`CompactionTask(ColumnFamilyStore cfs, java.util.Collection<SSTableReader> sstables, int gcBefore)`

Method Summary
`static long` `addToTotalBytesCompacted(long bytesCompacted)`
`int` `execute(CompactionManager.CompactionExecutorStatsCollector collector)` For internal use and testing only.
`static long` `getMaxDataAge(java.util.Collection<SSTableReader> sstables)`
`protected boolean` `isCompactionInteresting(java.util.Set<SSTableReader> toCompact)`
`CompactionTask` `isUserDefined(boolean isUserDefined)`
`protected boolean` `newSSTableSegmentThresholdReached(SSTableWriter writer)`
`protected boolean` `partialCompactionsAcceptable()`
`CompactionTask` `setCompactionType(OperationType compactionType)`

Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionTask
`cancel, getColumnFamilyStore, getSSTables, markSSTablesForCompaction, markSSTablesForCompaction, toString, unmarkSSTables`

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

### isUserDefined

    protected boolean isUserDefined

### compactionType

    protected OperationType compactionType

### totalBytesCompacted

    protected static long totalBytesCompacted

Constructor Detail

### CompactionTask

    public CompactionTask(ColumnFamilyStore cfs,
                          java.util.Collection<SSTableReader> sstables,
                          int gcBefore)

Method Detail

### addToTotalBytesCompacted

    public static long addToTotalBytesCompacted(long bytesCompacted)

### execute

    public int execute(CompactionManager.CompactionExecutorStatsCollector collector)
                throws java.io.IOException

  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:
    `execute` in class `AbstractCompactionTask`
  Throws:
    `java.io.IOException`

### partialCompactionsAcceptable

    protected boolean partialCompactionsAcceptable()

### newSSTableSegmentThresholdReached

    protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer)
                                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### isCompactionInteresting

    protected boolean isCompactionInteresting(java.util.Set<SSTableReader> toCompact)

  Returns:
    true if the proposed compaction is worth proceeding with. We allow leveled compaction to override this to allow "promoting" sstables from one level to another w/o rewriting them, if there is no overlapping.

### getMaxDataAge

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

### isUserDefined

    public CompactionTask isUserDefined(boolean isUserDefined)

### setCompactionType

    public CompactionTask setCompactionType(OperationType compactionType)

Copyright © 2013 The Apache Software Foundation