org.apache.cassandra.db.compaction
Class AbstractCompactionStrategy

java.lang.Object
  extended by org.apache.cassandra.db.compaction.AbstractCompactionStrategy
Direct Known Subclasses:
LeveledCompactionStrategy, SizeTieredCompactionStrategy

public abstract class AbstractCompactionStrategy
extends java.lang.Object

Pluggable compaction strategy determines how SSTables get merged. There are two main goals: - perform background compaction constantly as needed; this typically makes a tradeoff between i/o done by compaction, and merging done at read time. - perform a full (maximum possible) compaction if requested by the user


Field Summary
protected  ColumnFamilyStore cfs
           
protected  java.util.Map<java.lang.String,java.lang.String> options
           
 
Constructor Summary
protected AbstractCompactionStrategy(ColumnFamilyStore cfs, java.util.Map<java.lang.String,java.lang.String> options)
           
 
Method Summary
abstract  int getEstimatedRemainingTasks()
           
abstract  AbstractCompactionTask getMaximalTask(int gcBefore)
           
abstract  long getMaxSSTableSize()
           
abstract  AbstractCompactionTask getNextBackgroundTask(int gcBefore)
           
 java.util.Map<java.lang.String,java.lang.String> getOptions()
           
abstract  AbstractCompactionTask getUserDefinedTask(java.util.Collection<SSTableReader> sstables, int gcBefore)
           
abstract  boolean isKeyExistenceExpensive(java.util.Set<? extends SSTable> sstablesToIgnore)
           
 void shutdown()
          Releases any resources if this strategy is shutdown (when the CFS is reloaded after a schema change).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cfs

protected final ColumnFamilyStore cfs

options

protected final java.util.Map<java.lang.String,java.lang.String> options
Constructor Detail

AbstractCompactionStrategy

protected AbstractCompactionStrategy(ColumnFamilyStore cfs,
                                     java.util.Map<java.lang.String,java.lang.String> options)
Method Detail

getOptions

public java.util.Map<java.lang.String,java.lang.String> getOptions()

shutdown

public void shutdown()
Releases any resources if this strategy is shutdown (when the CFS is reloaded after a schema change). Default is to do nothing.


getNextBackgroundTask

public abstract AbstractCompactionTask getNextBackgroundTask(int gcBefore)
Parameters:
gcBefore - throw away tombstones older than this
Returns:
the next background/minor compaction task to run; null if nothing to do.

getMaximalTask

public abstract AbstractCompactionTask getMaximalTask(int gcBefore)
Parameters:
gcBefore - throw away tombstones older than this
Returns:
a compaction task that should be run to compact this columnfamilystore as much as possible. Null if nothing to do.

getUserDefinedTask

public abstract AbstractCompactionTask getUserDefinedTask(java.util.Collection<SSTableReader> sstables,
                                                          int gcBefore)
Parameters:
gcBefore - throw away tombstones older than this
Returns:
a compaction task corresponding to the requested sstables. Will not be null. (Will throw if user requests an invalid compaction.)

getEstimatedRemainingTasks

public abstract int getEstimatedRemainingTasks()
Returns:
the number of background tasks estimated to still be needed for this columnfamilystore

getMaxSSTableSize

public abstract long getMaxSSTableSize()
Returns:
size in bytes of the largest sstables for this strategy

isKeyExistenceExpensive

public abstract boolean isKeyExistenceExpensive(java.util.Set<? extends SSTable> sstablesToIgnore)
Returns:
true if checking for whether a key exists, ignoring @param sstablesToIgnore, is going to be expensive


Copyright © 2012 The Apache Software Foundation