Class Tracker
- java.lang.Object
-
- org.apache.cassandra.db.lifecycle.Tracker
-
public class Tracker extends java.lang.ObjectTracker tracks liveViewof data store for a table.
-
-
Field Summary
Fields Modifier and Type Field Description ColumnFamilyStorecfstorebooleanloadsstables
-
Constructor Summary
Constructors Constructor Description Tracker(ColumnFamilyStore columnFamilyStore, Memtable memtable, boolean loadsstables)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInitialSSTables(java.lang.Iterable<SSTableReader> sstables)voidaddInitialSSTablesWithoutUpdatingSize(java.lang.Iterable<SSTableReader> sstables)voidaddSSTables(java.lang.Iterable<SSTableReader> sstables)voiddropSSTables()java.lang.ThrowabledropSSTables(com.google.common.base.Predicate<SSTableReader> remove, OperationType operationType, java.lang.Throwable accumulate)removes all sstables that are not busy compacting.java.lang.ThrowabledropSSTables(java.lang.Throwable accumulate)java.lang.ThrowabledropSSTablesIfInvalid(java.lang.Throwable accumulate)java.util.Set<SSTableReader>getCompacting()MemtablegetMemtableFor(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)get the Memtable that the ordered writeOp should be directed tojava.lang.Iterable<SSTableReader>getUncompacting()java.lang.Iterable<SSTableReader>getUncompacting(java.lang.Iterable<SSTableReader> candidates)ViewgetView()booleanisDummy()voidmarkFlushing(Memtable memtable)voidmaybeIncrementallyBackup(java.lang.Iterable<SSTableReader> sstables)static TrackernewDummyTracker()voidnotifyDeleting(SSTableReader deleting)voidnotifyDiscarded(Memtable discarded)voidnotifyRenewed(Memtable renewed)voidnotifySSTableMetadataChanged(SSTableReader levelChanged, StatsMetadata oldMetadata)voidnotifySSTableRepairedStatusChanged(java.util.Collection<SSTableReader> repairStatusesChanged)voidnotifySwitched(Memtable previous)voidnotifyTruncated(long truncatedAt)voidremoveUnreadableSSTables(File directory)Removes every SSTable in the directory from the Tracker's view.voidremoveUnsafe(java.util.Set<SSTableReader> toRemove)voidreplaceFlushed(Memtable memtable, java.lang.Iterable<SSTableReader> sstables)voidreset(Memtable memtable)(Re)initializes the tracker, purging all references.voidsubscribe(INotificationConsumer consumer)MemtableswitchMemtable(boolean truncating, Memtable newMemtable)Switch the current memtable.LifecycleTransactiontryModify(java.lang.Iterable<SSTableReader> sstables, OperationType operationType)LifecycleTransactiontryModify(SSTableReader sstable, OperationType operationType)voidunsubscribe(INotificationConsumer consumer)voidupdateInitialSSTableSize(java.lang.Iterable<SSTableReader> sstables)
-
-
-
Field Detail
-
cfstore
public final ColumnFamilyStore cfstore
-
loadsstables
public final boolean loadsstables
-
-
Constructor Detail
-
Tracker
public Tracker(ColumnFamilyStore columnFamilyStore, Memtable memtable, boolean loadsstables)
- Parameters:
columnFamilyStore-memtable- Initial Memtable. Can be null.loadsstables- true to indicate to load SSTables (TODO: remove as this is only accessed from 2i)
-
-
Method Detail
-
newDummyTracker
public static Tracker newDummyTracker()
-
tryModify
public LifecycleTransaction tryModify(SSTableReader sstable, OperationType operationType)
-
tryModify
public LifecycleTransaction tryModify(java.lang.Iterable<SSTableReader> sstables, OperationType operationType)
- Returns:
- a Transaction over the provided sstables if we are able to mark the given @param sstables as compacted, before anyone else
-
addInitialSSTables
public void addInitialSSTables(java.lang.Iterable<SSTableReader> sstables)
-
addInitialSSTablesWithoutUpdatingSize
public void addInitialSSTablesWithoutUpdatingSize(java.lang.Iterable<SSTableReader> sstables)
-
updateInitialSSTableSize
public void updateInitialSSTableSize(java.lang.Iterable<SSTableReader> sstables)
-
addSSTables
public void addSSTables(java.lang.Iterable<SSTableReader> sstables)
-
reset
public void reset(Memtable memtable)
(Re)initializes the tracker, purging all references.
-
dropSSTablesIfInvalid
public java.lang.Throwable dropSSTablesIfInvalid(java.lang.Throwable accumulate)
-
dropSSTables
public void dropSSTables()
-
dropSSTables
public java.lang.Throwable dropSSTables(java.lang.Throwable accumulate)
-
dropSSTables
public java.lang.Throwable dropSSTables(com.google.common.base.Predicate<SSTableReader> remove, OperationType operationType, java.lang.Throwable accumulate)
removes all sstables that are not busy compacting.
-
removeUnreadableSSTables
public void removeUnreadableSSTables(File directory)
Removes every SSTable in the directory from the Tracker's view.- Parameters:
directory- the unreadable directory, possibly with SSTables in it, but not necessarily.
-
getMemtableFor
public Memtable getMemtableFor(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)
get the Memtable that the ordered writeOp should be directed to
-
switchMemtable
public Memtable switchMemtable(boolean truncating, Memtable newMemtable)
Switch the current memtable. This atomically appends a new memtable to the end of the list of active memtables, returning the previously last memtable. It leaves the previous Memtable in the list of live memtables until discarding(memtable) is called. These two methods must be synchronized/paired, i.e. m = switchMemtable must be followed by discarding(m), they cannot be interleaved.- Returns:
- the previously active memtable
-
markFlushing
public void markFlushing(Memtable memtable)
-
replaceFlushed
public void replaceFlushed(Memtable memtable, java.lang.Iterable<SSTableReader> sstables)
-
getCompacting
public java.util.Set<SSTableReader> getCompacting()
-
getUncompacting
public java.lang.Iterable<SSTableReader> getUncompacting()
-
getUncompacting
public java.lang.Iterable<SSTableReader> getUncompacting(java.lang.Iterable<SSTableReader> candidates)
-
maybeIncrementallyBackup
public void maybeIncrementallyBackup(java.lang.Iterable<SSTableReader> sstables)
-
notifySSTableRepairedStatusChanged
public void notifySSTableRepairedStatusChanged(java.util.Collection<SSTableReader> repairStatusesChanged)
-
notifySSTableMetadataChanged
public void notifySSTableMetadataChanged(SSTableReader levelChanged, StatsMetadata oldMetadata)
-
notifyDeleting
public void notifyDeleting(SSTableReader deleting)
-
notifyTruncated
public void notifyTruncated(long truncatedAt)
-
notifyRenewed
public void notifyRenewed(Memtable renewed)
-
notifySwitched
public void notifySwitched(Memtable previous)
-
notifyDiscarded
public void notifyDiscarded(Memtable discarded)
-
isDummy
public boolean isDummy()
-
subscribe
public void subscribe(INotificationConsumer consumer)
-
unsubscribe
public void unsubscribe(INotificationConsumer consumer)
-
getView
public View getView()
-
removeUnsafe
public void removeUnsafe(java.util.Set<SSTableReader> toRemove)
-
-