Package org.apache.bookkeeper.bookie
Class TransactionalEntryLogCompactor
java.lang.Object
org.apache.bookkeeper.bookie.AbstractLogCompactor
org.apache.bookkeeper.bookie.TransactionalEntryLogCompactor
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 ClassesModifier and TypeClassDescription(package private) static classAn abstract class that would be extended to be the actual transactional phases for compaction.(package private) classAssume we're compacting log 1 to log 3.(package private) classAssume we're compacting entry log 1 to entry log 3.(package private) classAssume 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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final String(package private) final EntryLogger(package private) final CompactableLedgerStorage(package private) final List<EntryLocation>Fields inherited from class org.apache.bookkeeper.bookie.AbstractLogCompactor
conf, logRemovalListener, throttler -
Constructor Summary
ConstructorsConstructorDescriptionTransactionalEntryLogCompactor(ServerConfiguration conf, EntryLogger entryLogger, CompactableLedgerStorage ledgerStorage, AbstractLogCompactor.LogRemovalListener logRemover) -
Method Summary
Modifier and TypeMethodDescriptionvoidDelete all previously incomplete compacting logs and recover the index for compacted logs.booleancompact(EntryLogMetadata metadata) Compact entry log file.
-
Field Details
-
entryLogger
-
ledgerStorage
-
offsets
-
COMPACTING_SUFFIX
- See Also:
-
COMPACTED_SUFFIX
- See Also:
-
-
Constructor Details
-
TransactionalEntryLogCompactor
public TransactionalEntryLogCompactor(ServerConfiguration conf, EntryLogger entryLogger, CompactableLedgerStorage ledgerStorage, AbstractLogCompactor.LogRemovalListener logRemover)
-
-
Method Details
-
cleanUpAndRecover
public void cleanUpAndRecover()Delete all previously incomplete compacting logs and recover the index for compacted logs.- Overrides:
cleanUpAndRecoverin classAbstractLogCompactor
-
compact
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
-