Class SizeTieredCompactionStrategy
java.lang.Object
org.apache.cassandra.db.compaction.AbstractCompactionStrategy
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
AbstractCompactionStrategy.ScannerList -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected SizeTieredCompactionStrategyOptionsprotected final Set<SSTableReader>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, options, TOMBSTONE_COMPACTION_INTERVAL_OPTION, TOMBSTONE_THRESHOLD_OPTION, tombstoneCompactionInterval, tombstoneThreshold, UNCHECKED_TOMBSTONE_COMPACTION_OPTION, uncheckedTombstoneCompaction -
Constructor Summary
ConstructorsConstructorDescriptionSizeTieredCompactionStrategy(ColumnFamilyStore cfs, Map<String, String> options) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSSTable(SSTableReader added) Adds sstable, note that implementations must handle duplicate notifications here (added already being in the compaction strategy)static List<Pair<SSTableReader,Long>> createSSTableAndLengthPairs(Iterable<SSTableReader> sstables) getBuckets(Collection<Pair<T, Long>> files, double bucketHigh, double bucketLow, long minSSTableSize) static intgetEstimatedCompactionsByTasks(ColumnFamilyStore cfs, List<List<SSTableReader>> tasks) intgetMaximalTask(long gcBefore, boolean splitOutput) longgetNextBackgroundTask(long gcBefore) protected Set<SSTableReader>Returns the sstables managed by this strategy instancegetUserDefinedTask(Collection<SSTableReader> sstables, long gcBefore) static List<SSTableReader>mostInterestingBucket(List<List<SSTableReader>> buckets, int minThreshold, int maxThreshold) voidremoveSSTable(SSTableReader sstable) Removes sstable from the strategy, implementations must be able to handle the sstable having already been removed.toString()validateOptions(Map<String, String> options) Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
addSSTables, createSSTableMultiWriter, filterSuspectSSTables, getCompactionTask, getDirectories, getName, getScanners, getScanners, getScanners, groupSSTablesForAntiCompaction, metadataChanged, pause, removeSSTables, replaceSSTables, resume, shutdown, startup, strategyLogger, supportsEarlyOpen, worthDroppingTombstones
-
Field Details
-
sizeTieredOptions
-
estimatedRemainingTasks
protected volatile int estimatedRemainingTasks -
sstables
-
-
Constructor Details
-
SizeTieredCompactionStrategy
-
-
Method Details
-
mostInterestingBucket
public static List<SSTableReader> mostInterestingBucket(List<List<SSTableReader>> buckets, int minThreshold, int maxThreshold) - Parameters:
buckets- list of buckets from which to return the most interesting, where "interesting" is the total hotness for readsminThreshold- minimum number of sstables in a bucket to qualify as interestingmaxThreshold- maximum number of sstables to compact at once (the returned bucket will be trimmed down to this)- Returns:
- a bucket (list) of sstables to compact
-
getNextBackgroundTask
- 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.
-
getMaximalTask
- 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.
-
getUserDefinedTask
- 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
-
createSSTableAndLengthPairs
public static List<Pair<SSTableReader,Long>> createSSTableAndLengthPairs(Iterable<SSTableReader> sstables) -
getBuckets
public static <T> List<List<T>> getBuckets(Collection<Pair<T, Long>> files, double bucketHigh, double bucketLow, long minSSTableSize) -
getEstimatedCompactionsByTasks
public static int getEstimatedCompactionsByTasks(ColumnFamilyStore cfs, List<List<SSTableReader>> tasks) -
getMaxSSTableBytes
public long getMaxSSTableBytes()- Specified by:
getMaxSSTableBytesin classAbstractCompactionStrategy- Returns:
- size in bytes of the largest sstables for this strategy
-
validateOptions
public static Map<String,String> validateOptions(Map<String, String> options) throws ConfigurationException- Throws:
ConfigurationException
-
addSSTable
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
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
Description copied from class:AbstractCompactionStrategyReturns the sstables managed by this strategy instance- Specified by:
getSSTablesin classAbstractCompactionStrategy
-
toString
-