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 class
TransactionalEntryLogCompactor.CompactionPhase
An abstract class that would be extended to be the actual transactional phases for compaction.(package private) class
TransactionalEntryLogCompactor.FlushCompactionLogPhase
Assume we're compacting log 1 to log 3.(package private) class
TransactionalEntryLogCompactor.ScanEntryLogPhase
Assume we're compacting entry log 1 to entry log 3.(package private) class
TransactionalEntryLogCompactor.UpdateIndexPhase
Assume 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.String
COMPACTED_SUFFIX
static java.lang.String
COMPACTING_SUFFIX
(package private) EntryLogger
entryLogger
(package private) CompactableLedgerStorage
ledgerStorage
(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 void
cleanUpAndRecover()
Delete all previously incomplete compacting logs and recover the index for compacted logs.boolean
compact(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:
cleanUpAndRecover
in classAbstractLogCompactor
-
compact
public boolean compact(EntryLogMetadata metadata)
Description copied from class:AbstractLogCompactor
Compact entry log file.- Specified by:
compact
in classAbstractLogCompactor
- Parameters:
metadata
- log metadata for the entry log to be compacted- Returns:
- true for succeed
-
-