Class 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.