org.apache.cassandra.db.compaction
Class AbstractCompactionStrategy
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cfs
protected final ColumnFamilyStore cfs
options
protected final java.util.Map<java.lang.String,java.lang.String> options
AbstractCompactionStrategy
protected AbstractCompactionStrategy(ColumnFamilyStore cfs,
java.util.Map<java.lang.String,java.lang.String> options)
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