Interface CompactionEntryLog
- All Known Implementing Classes:
DirectCompactionEntryLog
public interface CompactionEntryLog
An entrylog to received compacted entries.
The expected lifecycle for a compaction entry log is:
1. Creation
2. Mark compacted
3. Make available
4. Cleanup
Abort can happen at during any step.
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort the compaction log.longaddEntry(long ledgerId, io.netty.buffer.ByteBuf entry) Add an entry to the log.voidClean up any temporary resources that were used by the compaction process.voidflush()Flush any unwritten entries to physical storage.longGet the log ID of the entrylog to which compacted entries are being written.longGet the log ID of the entrylog which is being compacted.voidMake the log written by the compaction process available for reads.voidMark the compaction log as compacted.voidscan(EntryLogScanner scanner) Scan the entry log, reading out all contained entries.
-
Method Details
-
addEntry
Add an entry to the log.- Parameters:
ledgerId- the ledger the entry belong toentry- the payload of the entry- Returns:
- the position to which the entry was written
- Throws:
IOException
-
scan
Scan the entry log, reading out all contained entries.- Throws:
IOException
-
flush
Flush any unwritten entries to physical storage.- Throws:
IOException
-
abort
void abort()Abort the compaction log. This should delete any resources held by this log. -
markCompacted
Mark the compaction log as compacted. From this point, the heavy work of copying entries from one log to another should be done. We don't want to repeat that work, so this method should take steps to ensure that if the bookie crashes we can resume the compaction from this point.- Throws:
IOException
-
makeAvailable
Make the log written by the compaction process available for reads.- Throws:
IOException
-
finalizeAndCleanup
void finalizeAndCleanup()Clean up any temporary resources that were used by the compaction process. -
getDstLogId
long getDstLogId()Get the log ID of the entrylog to which compacted entries are being written. -
getSrcLogId
long getSrcLogId()Get the log ID of the entrylog which is being compacted.
-