Package org.apache.bookkeeper.bookie
Class TransactionalEntryLogCompactor
- java.lang.Object
-
- org.apache.bookkeeper.bookie.AbstractLogCompactor
-
- org.apache.bookkeeper.bookie.TransactionalEntryLogCompactor
-
public class TransactionalEntryLogCompactor extends AbstractLogCompactor
This class is used for compaction. Compaction is done in several transactional phases. Phase 1: Scan old entry log and compact entries to a new .compacting log file. Phase 2: Flush .compacting log to disk and it becomes .compacted log file when this completes. Phase 3: Flush ledger cache and .compacted file becomes .log file when this completes. Remove old entry log file afterwards.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classTransactionalEntryLogCompactor.CompactionPhaseAn abstract class that would be extended to be the actual transactional phases for compaction.(package private) classTransactionalEntryLogCompactor.FlushCompactionLogPhaseAssume we're compacting log 1 to log 3.(package private) classTransactionalEntryLogCompactor.ScanEntryLogPhaseAssume we're compacting entry log 1 to entry log 3.(package private) classTransactionalEntryLogCompactor.UpdateIndexPhaseAssume we're compacting log 1 to log 3.-
Nested classes/interfaces inherited from class org.apache.bookkeeper.bookie.AbstractLogCompactor
AbstractLogCompactor.LogRemovalListener, AbstractLogCompactor.Throttler
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMPACTED_SUFFIXstatic java.lang.StringCOMPACTING_SUFFIX(package private) EntryLoggerentryLogger(package private) CompactableLedgerStorageledgerStorage(package private) java.util.List<EntryLocation>offsets-
Fields inherited from class org.apache.bookkeeper.bookie.AbstractLogCompactor
conf, logRemovalListener, throttler
-
-
Constructor Summary
Constructors Constructor Description TransactionalEntryLogCompactor(ServerConfiguration conf, EntryLogger entryLogger, CompactableLedgerStorage ledgerStorage, AbstractLogCompactor.LogRemovalListener logRemover)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUpAndRecover()Delete all previously incomplete compacting logs and recover the index for compacted logs.booleancompact(EntryLogMetadata metadata)Compact entry log file.
-
-
-
Field Detail
-
entryLogger
final EntryLogger entryLogger
-
ledgerStorage
final CompactableLedgerStorage ledgerStorage
-
offsets
final java.util.List<EntryLocation> offsets
-
COMPACTING_SUFFIX
public static final java.lang.String COMPACTING_SUFFIX
- See Also:
- Constant Field Values
-
COMPACTED_SUFFIX
public static final java.lang.String COMPACTED_SUFFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TransactionalEntryLogCompactor
public TransactionalEntryLogCompactor(ServerConfiguration conf, EntryLogger entryLogger, CompactableLedgerStorage ledgerStorage, AbstractLogCompactor.LogRemovalListener logRemover)
-
-
Method Detail
-
cleanUpAndRecover
public void cleanUpAndRecover()
Delete all previously incomplete compacting logs and recover the index for compacted logs.- Overrides:
cleanUpAndRecoverin classAbstractLogCompactor
-
compact
public boolean compact(EntryLogMetadata metadata)
Description copied from class:AbstractLogCompactorCompact entry log file.- Specified by:
compactin classAbstractLogCompactor- Parameters:
metadata- log metadata for the entry log to be compacted- Returns:
- true for succeed
-
-