public abstract class AbstractCompactionStrategy
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractCompactionStrategy.ScannerList |
Modifier and Type | Field and Description |
---|---|
protected ColumnFamilyStore |
cfs |
protected static java.lang.String |
COMPACTION_ENABLED |
protected static boolean |
DEFAULT_LOG_ALL_OPTION |
protected static long |
DEFAULT_TOMBSTONE_COMPACTION_INTERVAL |
protected static float |
DEFAULT_TOMBSTONE_THRESHOLD |
protected static boolean |
DEFAULT_UNCHECKED_TOMBSTONE_COMPACTION_OPTION |
protected boolean |
disableTombstoneCompactions |
protected boolean |
isActive
pause/resume/getNextBackgroundTask must synchronize.
|
protected static java.lang.String |
LOG_ALL_OPTION |
protected boolean |
logAll |
static java.lang.String |
ONLY_PURGE_REPAIRED_TOMBSTONES |
protected java.util.Map<java.lang.String,java.lang.String> |
options |
protected static java.lang.String |
TOMBSTONE_COMPACTION_INTERVAL_OPTION |
protected static java.lang.String |
TOMBSTONE_THRESHOLD_OPTION |
protected long |
tombstoneCompactionInterval |
protected float |
tombstoneThreshold |
protected static java.lang.String |
UNCHECKED_TOMBSTONE_COMPACTION_OPTION |
protected boolean |
uncheckedTombstoneCompaction |
Modifier | Constructor and Description |
---|---|
protected |
AbstractCompactionStrategy(ColumnFamilyStore cfs,
java.util.Map<java.lang.String,java.lang.String> options) |
Modifier and Type | Method and Description |
---|---|
abstract void |
addSSTable(SSTableReader added)
Adds sstable, note that implementations must handle duplicate notifications here (added already being in the compaction strategy)
|
void |
addSSTables(java.lang.Iterable<SSTableReader> added)
Adds sstables, note that implementations must handle duplicate notifications here (added already being in the compaction strategy)
|
SSTableMultiWriter |
createSSTableMultiWriter(Descriptor descriptor,
long keyCount,
long repairedAt,
java.util.UUID pendingRepair,
boolean isTransient,
MetadataCollector meta,
SerializationHeader header,
java.util.Collection<Index> indexes,
LifecycleNewTracker lifecycleNewTracker) |
static java.util.List<SSTableReader> |
filterSuspectSSTables(java.lang.Iterable<SSTableReader> originalCandidates)
Filters SSTables that are to be excluded from the given collection
|
AbstractCompactionTask |
getCompactionTask(LifecycleTransaction txn,
int gcBefore,
long maxSSTableBytes) |
Directories |
getDirectories() |
abstract int |
getEstimatedRemainingTasks() |
abstract java.util.Collection<AbstractCompactionTask> |
getMaximalTask(int gcBefore,
boolean splitOutput) |
abstract long |
getMaxSSTableBytes() |
java.lang.String |
getName() |
abstract AbstractCompactionTask |
getNextBackgroundTask(int gcBefore) |
AbstractCompactionStrategy.ScannerList |
getScanners(java.util.Collection<SSTableReader> toCompact) |
AbstractCompactionStrategy.ScannerList |
getScanners(java.util.Collection<SSTableReader> sstables,
java.util.Collection<Range<Token>> ranges)
Returns a list of KeyScanners given sstables and a range on which to scan.
|
AbstractCompactionStrategy.ScannerList |
getScanners(java.util.Collection<SSTableReader> sstables,
Range<Token> range) |
protected abstract java.util.Set<SSTableReader> |
getSSTables()
Returns the sstables managed by this strategy instance
|
abstract AbstractCompactionTask |
getUserDefinedTask(java.util.Collection<SSTableReader> sstables,
int gcBefore) |
java.util.Collection<java.util.Collection<SSTableReader>> |
groupSSTablesForAntiCompaction(java.util.Collection<SSTableReader> sstablesToGroup)
Method for grouping similar SSTables together, This will be used by
anti-compaction to determine which SSTables should be anitcompacted
as a group.
|
void |
metadataChanged(StatsMetadata oldMetadata,
SSTableReader sstable)
Called when the metadata has changed for an sstable - for example if the level changed
Not called when repair status changes (which is also metadata), because this results in the
sstable getting removed from the compaction strategy instance.
|
void |
pause()
For internal, temporary suspension of background compactions so that we can do exceptional
things like truncate or major compaction
|
abstract void |
removeSSTable(SSTableReader sstable)
Removes sstable from the strategy, implementations must be able to handle the sstable having already been removed.
|
void |
removeSSTables(java.lang.Iterable<SSTableReader> removed)
Removes sstables from the strategy, implementations must be able to handle the sstables having already been removed.
|
void |
replaceSSTables(java.util.Collection<SSTableReader> removed,
java.util.Collection<SSTableReader> added)
Replaces sstables in the compaction strategy
Note that implementations must be able to handle duplicate notifications here (that removed are already gone and
added have already been added)
|
void |
resume()
For internal, temporary suspension of background compactions so that we can do exceptional
things like truncate or major compaction
|
void |
shutdown()
Releases any resources if this strategy is shutdown (when the CFS is reloaded after a schema change).
|
void |
startup()
Performs any extra initialization required
|
CompactionLogger.Strategy |
strategyLogger() |
boolean |
supportsEarlyOpen() |
static java.util.Map<java.lang.String,java.lang.String> |
validateOptions(java.util.Map<java.lang.String,java.lang.String> options) |
protected boolean |
worthDroppingTombstones(SSTableReader sstable,
int gcBefore)
Check if given sstable is worth dropping tombstones at gcBefore.
|
protected static final float DEFAULT_TOMBSTONE_THRESHOLD
protected static final long DEFAULT_TOMBSTONE_COMPACTION_INTERVAL
protected static final boolean DEFAULT_UNCHECKED_TOMBSTONE_COMPACTION_OPTION
protected static final boolean DEFAULT_LOG_ALL_OPTION
protected static final java.lang.String TOMBSTONE_THRESHOLD_OPTION
protected static final java.lang.String TOMBSTONE_COMPACTION_INTERVAL_OPTION
protected static final java.lang.String UNCHECKED_TOMBSTONE_COMPACTION_OPTION
protected static final java.lang.String LOG_ALL_OPTION
protected static final java.lang.String COMPACTION_ENABLED
public static final java.lang.String ONLY_PURGE_REPAIRED_TOMBSTONES
protected java.util.Map<java.lang.String,java.lang.String> options
protected final ColumnFamilyStore cfs
protected float tombstoneThreshold
protected long tombstoneCompactionInterval
protected boolean uncheckedTombstoneCompaction
protected boolean disableTombstoneCompactions
protected boolean logAll
protected boolean isActive
protected AbstractCompactionStrategy(ColumnFamilyStore cfs, java.util.Map<java.lang.String,java.lang.String> options)
public Directories getDirectories()
public void pause()
public void resume()
public void startup()
public void shutdown()
public abstract AbstractCompactionTask getNextBackgroundTask(int gcBefore)
gcBefore
- throw away tombstones older than thispublic abstract java.util.Collection<AbstractCompactionTask> getMaximalTask(int gcBefore, boolean splitOutput)
gcBefore
- throw away tombstones older than thispublic abstract AbstractCompactionTask getUserDefinedTask(java.util.Collection<SSTableReader> sstables, int gcBefore)
sstables
- SSTables to compact. Must be marked as compacting.gcBefore
- throw away tombstones older than thispublic AbstractCompactionTask getCompactionTask(LifecycleTransaction txn, int gcBefore, long maxSSTableBytes)
public abstract int getEstimatedRemainingTasks()
public abstract long getMaxSSTableBytes()
public static java.util.List<SSTableReader> filterSuspectSSTables(java.lang.Iterable<SSTableReader> originalCandidates)
originalCandidates
- The collection to check for excluded SSTablespublic AbstractCompactionStrategy.ScannerList getScanners(java.util.Collection<SSTableReader> sstables, Range<Token> range)
public AbstractCompactionStrategy.ScannerList getScanners(java.util.Collection<SSTableReader> sstables, java.util.Collection<Range<Token>> ranges)
public java.lang.String getName()
public void replaceSSTables(java.util.Collection<SSTableReader> removed, java.util.Collection<SSTableReader> added)
public abstract void addSSTable(SSTableReader added)
public void addSSTables(java.lang.Iterable<SSTableReader> added)
public abstract void removeSSTable(SSTableReader sstable)
public void removeSSTables(java.lang.Iterable<SSTableReader> removed)
protected abstract java.util.Set<SSTableReader> getSSTables()
public void metadataChanged(StatsMetadata oldMetadata, SSTableReader sstable)
oldMetadata
- sstable
- public AbstractCompactionStrategy.ScannerList getScanners(java.util.Collection<SSTableReader> toCompact)
protected boolean worthDroppingTombstones(SSTableReader sstable, int gcBefore)
sstable
- SSTable to checkgcBefore
- time to drop tombstonespublic static java.util.Map<java.lang.String,java.lang.String> validateOptions(java.util.Map<java.lang.String,java.lang.String> options) throws ConfigurationException
ConfigurationException
public java.util.Collection<java.util.Collection<SSTableReader>> groupSSTablesForAntiCompaction(java.util.Collection<SSTableReader> sstablesToGroup)
public CompactionLogger.Strategy strategyLogger()
public SSTableMultiWriter createSSTableMultiWriter(Descriptor descriptor, long keyCount, long repairedAt, java.util.UUID pendingRepair, boolean isTransient, MetadataCollector meta, SerializationHeader header, java.util.Collection<Index> indexes, LifecycleNewTracker lifecycleNewTracker)
public boolean supportsEarlyOpen()
Copyright © 2009- The Apache Software Foundation