org.apache.cassandra.db.compaction
Class CompactionTask

java.lang.Object
  extended by org.apache.cassandra.utils.WrappedRunnable
      extended by org.apache.cassandra.io.util.DiskAwareRunnable
          extended by org.apache.cassandra.db.compaction.AbstractCompactionTask
              extended by org.apache.cassandra.db.compaction.CompactionTask
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
LeveledCompactionTask

public class CompactionTask
extends AbstractCompactionTask


Field Summary
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
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.
 long getExpectedWriteSize()
          Get expected write size to determine which disk to use for this task.
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 dataDirectory)
          For internal use and testing only.
 
Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionTask
setCompactionType, setUserDefined, toString, unmarkSSTables
 
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.util.Collection<SSTableReader> sstables,
                      int gcBefore)
Method Detail

addToTotalBytesCompacted

public static long addToTotalBytesCompacted(long bytesCompacted)

execute

public int execute(CompactionManager.CompactionExecutorStatsCollector collector)
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

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 dataDirectory)
                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:
dataDirectory - data directory to work on
Throws:
java.lang.Exception

partialCompactionsAcceptable

protected boolean partialCompactionsAcceptable()

newSSTableSegmentThresholdReached

protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer)

getMaxDataAge

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


Copyright © 2013 The Apache Software Foundation