org.apache.cassandra.db

## Class DataTracker

- java.lang.Object
- - org.apache.cassandra.db.DataTracker

    public class DataTracker
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`static class` `DataTracker.SSTableIntervalTree`
`static class` `DataTracker.View` An immutable structure holding the current memtable, the memtables pending flush, the sstables for a column family, and the sstables that are active in compaction (a subset of the sstables).

### Field Summary

Fields
`ColumnFamilyStore` `cfstore`
`java.util.Collection<INotificationConsumer>` `subscribers`

### Constructor Summary

Constructors
Constructor and Description
`DataTracker(ColumnFamilyStore cfstore)`

### Method Summary

Methods
`void` `addInitialSSTables(java.util.Collection<SSTableReader> sstables)`
`void` `addSSTables(java.util.Collection<SSTableReader> sstables)`
`static DataTracker.SSTableIntervalTree` `buildIntervalTree(java.lang.Iterable<SSTableReader> sstables)`
`long` `estimatedKeys()`
`java.util.Set<SSTableReader>` `getCompacting()`
`double` `getDroppableTombstoneRatio()`
`int` `getMeanColumns()`
`Memtable` `getMemtableFor(OpOrder.Group opGroup)`
`java.util.Set<SSTableReader>` `getSSTables()`
`java.util.Set<SSTableReader>` `getUncompactingSSTables()`
`java.lang.Iterable<SSTableReader>` `getUncompactingSSTables(java.lang.Iterable<SSTableReader> candidates)`
`DataTracker.View` `getView()`
`void` `markCompactedSSTablesReplaced(java.util.Collection<SSTableReader> sstables, java.util.Collection<SSTableReader> allReplacements, OperationType compactionType)`
`boolean` `markCompacting(java.lang.Iterable<SSTableReader> sstables)`
`void` `markFlushing(Memtable memtable)`
`void` `markObsolete(java.util.Collection<SSTableReader> sstables, OperationType compactionType)`
`void` `maybeIncrementallyBackup(SSTableReader sstable)`
`void` `notifyAdded(SSTableReader added)`
`void` `notifyDeleting(SSTableReader deleting)`
`void` `notifyRenewed(Memtable renewed)`
`void` `notifySSTableRepairedStatusChanged(java.util.Collection<SSTableReader> repairStatusesChanged)`
`void` `notifySSTablesChanged(java.util.Collection<SSTableReader> removed, java.util.Collection<SSTableReader> added, OperationType compactionType)`
`void` `replaceFlushed(Memtable memtable, SSTableReader sstable)`
`void` `replaceReaders(java.util.Collection<SSTableReader> oldSSTables, java.util.Collection<SSTableReader> newSSTables)` A special kind of replacement for SSTableReaders that were cloned with a new index summary sampling level (see SSTableReader.cloneWithNewSummarySamplingLevel and CASSANDRA-5519).
`void` `spaceReclaimed(long size)`
`void` `subscribe(INotificationConsumer consumer)`
`Memtable` `switchMemtable(boolean truncating)` Switch the current memtable.
`void` `unmarkCompacting(java.lang.Iterable<SSTableReader> unmark)` Removes files from compacting status: this is different from 'markObsolete' because it should be run regardless of whether a compaction succeeded.
`void` `unreferenceSSTables()` removes all sstables that are not busy compacting.
`void` `unsubscribe(INotificationConsumer consumer)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### subscribers

    public final java.util.Collection<INotificationConsumer> subscribers

#### cfstore

    public final ColumnFamilyStore cfstore

### Constructor Detail

#### DataTracker

    public DataTracker(ColumnFamilyStore cfstore)

### Method Detail

#### getMemtableFor

    public Memtable getMemtableFor(OpOrder.Group opGroup)

#### getSSTables

    public java.util.Set<SSTableReader> getSSTables()

#### getUncompactingSSTables

    public java.util.Set<SSTableReader> getUncompactingSSTables()

#### getUncompactingSSTables

    public java.lang.Iterable<SSTableReader> getUncompactingSSTables(java.lang.Iterable<SSTableReader> candidates)

#### getView

    public DataTracker.View getView()

#### switchMemtable

    public Memtable switchMemtable(boolean truncating)

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,
                      SSTableReader sstable)

#### maybeIncrementallyBackup

    public void maybeIncrementallyBackup(SSTableReader sstable)

#### markCompacting

    public boolean markCompacting(java.lang.Iterable<SSTableReader> sstables)

Returns:
  true if we are able to mark the given @param sstables as compacted, before anyone else Note that we could acquire references on the marked sstables and release them in unmarkCompacting, but since we will never call markObsolete on a sstable marked as compacting (unless there is a serious bug), we can skip this.

#### unmarkCompacting

    public void unmarkCompacting(java.lang.Iterable<SSTableReader> unmark)

Removes files from compacting status: this is different from 'markObsolete' because it should be run regardless of whether a compaction succeeded.

#### markObsolete

    public void markObsolete(java.util.Collection<SSTableReader> sstables,
                    OperationType compactionType)

#### markCompactedSSTablesReplaced

    public void markCompactedSSTablesReplaced(java.util.Collection<SSTableReader> sstables,
                                     java.util.Collection<SSTableReader> allReplacements,
                                     OperationType compactionType)

#### addInitialSSTables

    public void addInitialSSTables(java.util.Collection<SSTableReader> sstables)

#### addSSTables

    public void addSSTables(java.util.Collection<SSTableReader> sstables)

#### unreferenceSSTables

    public void unreferenceSSTables()

removes all sstables that are not busy compacting.

#### replaceReaders

    public void replaceReaders(java.util.Collection<SSTableReader> oldSSTables,
                      java.util.Collection<SSTableReader> newSSTables)

A special kind of replacement for SSTableReaders that were cloned with a new index summary sampling level (see SSTableReader.cloneWithNewSummarySamplingLevel and CASSANDRA-5519). This does not mark the old reader as compacted.

Parameters:
  `oldSSTables` - replaced readers
  `newSSTables` - replacement readers

#### spaceReclaimed

    public void spaceReclaimed(long size)

#### estimatedKeys

    public long estimatedKeys()

#### getMeanColumns

    public int getMeanColumns()

#### getDroppableTombstoneRatio

    public double getDroppableTombstoneRatio()

#### notifySSTablesChanged

    public void notifySSTablesChanged(java.util.Collection<SSTableReader> removed,
                             java.util.Collection<SSTableReader> added,
                             OperationType compactionType)

#### notifyAdded

    public void notifyAdded(SSTableReader added)

#### notifySSTableRepairedStatusChanged

    public void notifySSTableRepairedStatusChanged(java.util.Collection<SSTableReader> repairStatusesChanged)

#### notifyDeleting

    public void notifyDeleting(SSTableReader deleting)

#### notifyRenewed

    public void notifyRenewed(Memtable renewed)

#### subscribe

    public void subscribe(INotificationConsumer consumer)

#### unsubscribe

    public void unsubscribe(INotificationConsumer consumer)

#### buildIntervalTree

    public static DataTracker.SSTableIntervalTree buildIntervalTree(java.lang.Iterable<SSTableReader> sstables)

#### getCompacting

    public java.util.Set<SSTableReader> getCompacting()