Class TimeWindowCompactionStrategy
- java.lang.Object
-
- org.apache.cassandra.db.compaction.AbstractCompactionStrategy
-
- org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy
-
public class TimeWindowCompactionStrategy extends AbstractCompactionStrategy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
AbstractCompactionStrategy.ScannerList
-
-
Field Summary
Fields Modifier and Type Field Description protected intestimatedRemainingTasks-
Fields inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
cfs, COMPACTION_ENABLED, DEFAULT_LOG_ALL_OPTION, DEFAULT_TOMBSTONE_COMPACTION_INTERVAL, DEFAULT_TOMBSTONE_THRESHOLD, DEFAULT_UNCHECKED_TOMBSTONE_COMPACTION_OPTION, disableTombstoneCompactions, isActive, LOG_ALL_OPTION, logAll, ONLY_PURGE_REPAIRED_TOMBSTONES, TOMBSTONE_COMPACTION_INTERVAL_OPTION, TOMBSTONE_THRESHOLD_OPTION, tombstoneCompactionInterval, tombstoneThreshold, UNCHECKED_TOMBSTONE_COMPACTION_OPTION, uncheckedTombstoneCompaction
-
-
Constructor Summary
Constructors Constructor Description TimeWindowCompactionStrategy(ColumnFamilyStore cfs, java.util.Map<java.lang.String,java.lang.String> options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSSTable(SSTableReader sstable)Adds sstable, note that implementations must handle duplicate notifications here (added already being in the compaction strategy)intgetEstimatedRemainingTasks()java.util.Collection<AbstractCompactionTask>getMaximalTask(int gcBefore, boolean splitOutput)longgetMaxSSTableBytes()AbstractCompactionTaskgetNextBackgroundTask(int gcBefore)protected java.util.Set<SSTableReader>getSSTables()Returns the sstables managed by this strategy instanceAbstractCompactionTaskgetUserDefinedTask(java.util.Collection<SSTableReader> sstables, int gcBefore)static Pair<java.lang.Long,java.lang.Long>getWindowBoundsInMillis(java.util.concurrent.TimeUnit windowTimeUnit, int windowTimeSize, long timestampInMillis)Find the lowest and highest timestamps in a given timestamp/unit pair Returns milliseconds, caller should adjust accordinglyjava.util.Collection<java.util.Collection<SSTableReader>>groupSSTablesForAntiCompaction(java.util.Collection<SSTableReader> sstablesToGroup)TWCS should not group sstables for anticompaction - this can mix new and old datavoidremoveSSTable(SSTableReader sstable)Removes sstable from the strategy, implementations must be able to handle the sstable having already been removed.java.lang.StringtoString()static java.util.Map<java.lang.String,java.lang.String>validateOptions(java.util.Map<java.lang.String,java.lang.String> options)-
Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
addSSTables, createSSTableMultiWriter, filterSuspectSSTables, getCompactionTask, getDirectories, getName, getScanners, getScanners, getScanners, metadataChanged, pause, removeSSTables, replaceSSTables, resume, shutdown, startup, strategyLogger, supportsEarlyOpen, worthDroppingTombstones
-
-
-
-
Constructor Detail
-
TimeWindowCompactionStrategy
public TimeWindowCompactionStrategy(ColumnFamilyStore cfs, java.util.Map<java.lang.String,java.lang.String> options)
-
-
Method Detail
-
getNextBackgroundTask
public AbstractCompactionTask getNextBackgroundTask(int gcBefore)
- Specified by:
getNextBackgroundTaskin classAbstractCompactionStrategy- Parameters:
gcBefore- throw away tombstones older than this- Returns:
- the next background/minor compaction task to run; null if nothing to do. Is responsible for marking its sstables as compaction-pending.
-
addSSTable
public void addSSTable(SSTableReader sstable)
Description copied from class:AbstractCompactionStrategyAdds sstable, note that implementations must handle duplicate notifications here (added already being in the compaction strategy)- Specified by:
addSSTablein classAbstractCompactionStrategy
-
removeSSTable
public void removeSSTable(SSTableReader sstable)
Description copied from class:AbstractCompactionStrategyRemoves sstable from the strategy, implementations must be able to handle the sstable having already been removed.- Specified by:
removeSSTablein classAbstractCompactionStrategy
-
getSSTables
protected java.util.Set<SSTableReader> getSSTables()
Description copied from class:AbstractCompactionStrategyReturns the sstables managed by this strategy instance- Specified by:
getSSTablesin classAbstractCompactionStrategy
-
getWindowBoundsInMillis
public static Pair<java.lang.Long,java.lang.Long> getWindowBoundsInMillis(java.util.concurrent.TimeUnit windowTimeUnit, int windowTimeSize, long timestampInMillis)
Find the lowest and highest timestamps in a given timestamp/unit pair Returns milliseconds, caller should adjust accordingly
-
getMaximalTask
public java.util.Collection<AbstractCompactionTask> getMaximalTask(int gcBefore, boolean splitOutput)
- Specified by:
getMaximalTaskin classAbstractCompactionStrategy- 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. Is responsible for marking its sstables as compaction-pending.
-
groupSSTablesForAntiCompaction
public java.util.Collection<java.util.Collection<SSTableReader>> groupSSTablesForAntiCompaction(java.util.Collection<SSTableReader> sstablesToGroup)
TWCS should not group sstables for anticompaction - this can mix new and old data- Overrides:
groupSSTablesForAntiCompactionin classAbstractCompactionStrategy
-
getUserDefinedTask
public AbstractCompactionTask getUserDefinedTask(java.util.Collection<SSTableReader> sstables, int gcBefore)
- Specified by:
getUserDefinedTaskin classAbstractCompactionStrategy- Parameters:
sstables- SSTables to compact. Must be marked as compacting.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.) Is responsible for marking its sstables as compaction-pending.
-
getEstimatedRemainingTasks
public int getEstimatedRemainingTasks()
- Specified by:
getEstimatedRemainingTasksin classAbstractCompactionStrategy- Returns:
- the number of background tasks estimated to still be needed for this columnfamilystore
-
getMaxSSTableBytes
public long getMaxSSTableBytes()
- Specified by:
getMaxSSTableBytesin classAbstractCompactionStrategy- Returns:
- size in bytes of the largest sstables for this strategy
-
validateOptions
public static java.util.Map<java.lang.String,java.lang.String> validateOptions(java.util.Map<java.lang.String,java.lang.String> options) throws ConfigurationException- Throws:
ConfigurationException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-