Class CompactionController
- java.lang.Object
-
- org.apache.cassandra.db.AbstractCompactionController
-
- org.apache.cassandra.db.compaction.CompactionController
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
SortedTableVerifier.VerifyController
,SSTableSplitter.SplitController
,TimeWindowCompactionController
public class CompactionController extends AbstractCompactionController
Manage compaction options.
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.db.AbstractCompactionController
cfs, gcBefore, tombstoneOption
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompactionController(ColumnFamilyStore cfs, long maxValue)
CompactionController(ColumnFamilyStore cfs, java.util.Set<SSTableReader> compacting, long gcBefore)
CompactionController(ColumnFamilyStore cfs, java.util.Set<SSTableReader> compacting, long gcBefore, com.google.common.util.concurrent.RateLimiter limiter, CompactionParams.TombstoneOption tombstoneOption)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
compactingRepaired()
java.util.Set<SSTableReader>
getFullyExpiredSSTables()
static java.util.Set<SSTableReader>
getFullyExpiredSSTables(ColumnFamilyStore cfStore, java.lang.Iterable<SSTableReader> compacting, java.lang.Iterable<SSTableReader> overlapping, long gcBefore)
static java.util.Set<SSTableReader>
getFullyExpiredSSTables(ColumnFamilyStore cfStore, java.lang.Iterable<SSTableReader> compacting, java.lang.Iterable<SSTableReader> overlapping, long gcBefore, boolean ignoreOverlaps)
Finds expired sstables works something like this; 1.java.util.function.LongPredicate
getPurgeEvaluator(DecoratedKey key)
protected boolean
ignoreOverlaps()
Is overlapped sstables ignored Control whether or not we are taking into account overlapping sstables when looking for fully expired sstables.void
maybeRefreshOverlaps()
java.lang.Iterable<UnfilteredRowIterator>
shadowSources(DecoratedKey key, boolean tombstoneOnly)
-
Methods inherited from class org.apache.cassandra.db.AbstractCompactionController
getColumnFamily, getKeyspace
-
-
-
-
Constructor Detail
-
CompactionController
protected CompactionController(ColumnFamilyStore cfs, long maxValue)
-
CompactionController
public CompactionController(ColumnFamilyStore cfs, java.util.Set<SSTableReader> compacting, long gcBefore)
-
CompactionController
public CompactionController(ColumnFamilyStore cfs, java.util.Set<SSTableReader> compacting, long gcBefore, com.google.common.util.concurrent.RateLimiter limiter, CompactionParams.TombstoneOption tombstoneOption)
-
-
Method Detail
-
maybeRefreshOverlaps
public void maybeRefreshOverlaps()
-
getFullyExpiredSSTables
public java.util.Set<SSTableReader> getFullyExpiredSSTables()
-
getFullyExpiredSSTables
public static java.util.Set<SSTableReader> getFullyExpiredSSTables(ColumnFamilyStore cfStore, java.lang.Iterable<SSTableReader> compacting, java.lang.Iterable<SSTableReader> overlapping, long gcBefore, boolean ignoreOverlaps)
Finds expired sstables works something like this; 1. find "global" minTimestamp of overlapping sstables, compacting sstables and memtables containing any non-expired data 2. build a list of fully expired candidates 3. check if the candidates to be dropped actually can be dropped(maxTimestamp < global minTimestamp)
- if not droppable, remove from candidates 4. return candidates.- Parameters:
cfStore
-compacting
- we take the drop-candidates from this set, it is usually the sstables included in the compactionoverlapping
- the sstables that overlap the ones in compacting.gcBefore
-ignoreOverlaps
- don't check if data shadows/overlaps any data in other sstables- Returns:
-
getFullyExpiredSSTables
public static java.util.Set<SSTableReader> getFullyExpiredSSTables(ColumnFamilyStore cfStore, java.lang.Iterable<SSTableReader> compacting, java.lang.Iterable<SSTableReader> overlapping, long gcBefore)
-
getPurgeEvaluator
public java.util.function.LongPredicate getPurgeEvaluator(DecoratedKey key)
- Specified by:
getPurgeEvaluator
in classAbstractCompactionController
- Parameters:
key
-- Returns:
- a predicate for whether tombstones marked for deletion at the given time for the given partition are purgeable; we calculate this by checking whether the deletion time is less than the min timestamp of all SSTables containing his partition and not participating in the compaction. This means there isn't any data in those sstables that might still need to be suppressed by a tombstone at this timestamp.
-
close
public void close()
-
compactingRepaired
public boolean compactingRepaired()
- Specified by:
compactingRepaired
in classAbstractCompactionController
-
shadowSources
public java.lang.Iterable<UnfilteredRowIterator> shadowSources(DecoratedKey key, boolean tombstoneOnly)
- Overrides:
shadowSources
in classAbstractCompactionController
-
ignoreOverlaps
protected boolean ignoreOverlaps()
Is overlapped sstables ignored Control whether or not we are taking into account overlapping sstables when looking for fully expired sstables. In order to reduce the amount of work needed, we look for sstables that can be dropped instead of compacted. As a safeguard mechanism, for each time range of data in a sstable, we are checking globally to see if all data of this time range is fully expired before considering to drop the sstable. This strategy can retain for a long time a lot of sstables on disk (see CASSANDRA-13418) so this option control whether or not this check should be ignored. Do NOT call this method in the CompactionController constructor- Returns:
- false by default
-
-