Class CompactionIterator
- java.lang.Object
-
- org.apache.cassandra.db.compaction.CompactionInfo.Holder
-
- org.apache.cassandra.db.compaction.CompactionIterator
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.util.Iterator<UnfilteredRowIterator>,BasePartitionIterator<UnfilteredRowIterator>,UnfilteredPartitionIterator,CloseableIterator<UnfilteredRowIterator>
public class CompactionIterator extends CompactionInfo.Holder implements UnfilteredPartitionIterator
Merge multiple iterators over the content of sstable into a "compacted" iterator.On top of the actual merging the source iterators, this class:
- purge gc-able tombstones if possible (see PurgeIterator below).
- update 2ndary indexes if necessary (as we don't read-before-write on index updates, index entries are not deleted on deletion of the base table data, which is ok because we'll fix index inconsistency on reads. This however mean that potentially obsolete index entries could be kept a long time for data that is not read often, so compaction "pro-actively" fix such index entries. This is mainly an optimization).
- invalidate cached partitions that are empty post-compaction. This avoids keeping partitions with only purgable tombstones in the row cache.
- keep tracks of the compaction progress.
-
-
Constructor Summary
Constructors Constructor Description CompactionIterator(OperationType type, java.util.List<ISSTableScanner> scanners, AbstractCompactionController controller, int nowInSec, TimeUUID compactionId)CompactionIterator(OperationType type, java.util.List<ISSTableScanner> scanners, AbstractCompactionController controller, int nowInSec, TimeUUID compactionId, ActiveCompactionsTracker activeCompactions, TopPartitionTracker.Collector topPartitionCollector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longgetBytesRead()CompactionInfogetCompactionInfo()long[]getMergedRowCounts()longgetTotalSourceCQLRows()booleanhasNext()booleanisGlobal()if this compaction involves several/all tables we can safely check globalCompactionsPaused in isStopRequested() belowTableMetadatametadata()UnfilteredRowIteratornext()voidremove()java.lang.StringtoString()-
Methods inherited from class org.apache.cassandra.db.compaction.CompactionInfo.Holder
isStopRequested, stop
-
-
-
-
Constructor Detail
-
CompactionIterator
public CompactionIterator(OperationType type, java.util.List<ISSTableScanner> scanners, AbstractCompactionController controller, int nowInSec, TimeUUID compactionId)
-
CompactionIterator
public CompactionIterator(OperationType type, java.util.List<ISSTableScanner> scanners, AbstractCompactionController controller, int nowInSec, TimeUUID compactionId, ActiveCompactionsTracker activeCompactions, TopPartitionTracker.Collector topPartitionCollector)
-
-
Method Detail
-
metadata
public TableMetadata metadata()
- Specified by:
metadatain interfaceUnfilteredPartitionIterator
-
getCompactionInfo
public CompactionInfo getCompactionInfo()
- Specified by:
getCompactionInfoin classCompactionInfo.Holder
-
isGlobal
public boolean isGlobal()
Description copied from class:CompactionInfo.Holderif this compaction involves several/all tables we can safely check globalCompactionsPaused in isStopRequested() below- Specified by:
isGlobalin classCompactionInfo.Holder
-
getMergedRowCounts
public long[] getMergedRowCounts()
-
getTotalSourceCQLRows
public long getTotalSourceCQLRows()
-
getBytesRead
public long getBytesRead()
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<UnfilteredRowIterator>
-
next
public UnfilteredRowIterator next()
- Specified by:
nextin interfacejava.util.Iterator<UnfilteredRowIterator>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<UnfilteredRowIterator>
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceBasePartitionIterator<UnfilteredRowIterator>- Specified by:
closein interfaceCloseableIterator<UnfilteredRowIterator>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-