Class TransactionalEntryLogCompactor.ScanEntryLogPhase

  • Enclosing class:
    TransactionalEntryLogCompactor

    class TransactionalEntryLogCompactor.ScanEntryLogPhase
    extends TransactionalEntryLogCompactor.CompactionPhase
    Assume we're compacting entry log 1 to entry log 3. The first phase is to scan entries in 1.log and copy them to compaction log file "3.log.compacting". We'll try to allocate a new compaction log before scanning to make sure we have a log file to write. If after scanning, there's no data written, it means there's no valid entries to be compacted, so we can remove 1.log directly, clear the offsets and end the compaction. Otherwise, we should move on to the next phase.

    If anything failed in this phase, we should delete the compaction log and clean the offsets.