Package org.apache.bookkeeper.bookie
Class EntryLogManagerForEntryLogPerLedger
- java.lang.Object
-
- org.apache.bookkeeper.bookie.EntryLogManagerBase
-
- org.apache.bookkeeper.bookie.EntryLogManagerForEntryLogPerLedger
-
- All Implemented Interfaces:
EntryLogManager
class EntryLogManagerForEntryLogPerLedger extends EntryLogManagerBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
EntryLogManagerForEntryLogPerLedger.BufferedLogChannelWithDirInfo
(package private) class
EntryLogManagerForEntryLogPerLedger.EntryLogAndLockTuple
(package private) class
EntryLogManagerForEntryLogPerLedger.EntryLogsPerLedgerCounter
-
Field Summary
Fields Modifier and Type Field Description (package private) EntryLogManagerForEntryLogPerLedger.EntryLogsPerLedgerCounter
entryLogsPerLedgerCounter
-
Fields inherited from class org.apache.bookkeeper.bookie.EntryLogManagerBase
entryLoggerAllocator, ledgerDirsManager, logSizeLimit, rotatedLogChannels
-
-
Constructor Summary
Constructors Constructor Description EntryLogManagerForEntryLogPerLedger(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, EntryLoggerAllocator entryLoggerAllocator, java.util.List<DefaultEntryLogger.EntryLogListener> listeners, DefaultEntryLogger.RecentEntryLogsStatus recentlyCreatedEntryLogsStatus, StatsLogger statsLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addEntry(long ledger, io.netty.buffer.ByteBuf entry, boolean rollLog)
void
checkpoint()
void
close()
boolean
commitEntryMemTableFlush()
(package private) void
createNewLog(long ledgerId)
DefaultEntryLogger.BufferedLogChannel
createNewLogForCompaction()
flushCurrentLogs method is called during checkpoint, so metadata of the file also should be force written.(package private) void
doEntryLogMapCleanup()
(package private) void
flushCurrentLogs()
void
flushRotatedLogs()
if disk of the logChannel is full or if the entrylog limit is reached of if the logchannel is not initialized, then createNewLog.void
forceClose()
(package private) java.util.concurrent.ConcurrentMap<java.lang.Long,EntryLogManagerForEntryLogPerLedger.EntryLogAndLockTuple>
getCacheAsMap()
java.util.Set<EntryLogManagerForEntryLogPerLedger.BufferedLogChannelWithDirInfo>
getCopyOfCurrentLogs()
DefaultEntryLogger.BufferedLogChannel
getCurrentLogForLedger(long ledgerId)
(package private) DefaultEntryLogger.BufferedLogChannel
getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog)
DefaultEntryLogger.BufferedLogChannel
getCurrentLogIfPresent(long entryLogId)
EntryLogManagerForEntryLogPerLedger.BufferedLogChannelWithDirInfo
getCurrentLogWithDirInfoForLedger(long ledgerId)
java.io.File
getDirForNextEntryLog(java.util.List<java.io.File> writableLedgerDirs)
(package private) java.util.concurrent.locks.Lock
getLock(long ledgerId)
void
prepareEntryMemTableFlush()
void
prepareSortedLedgerStorageCheckpoint(long numBytesFlushed)
void
setCurrentLogForLedgerAndAddToRotate(long ledgerId, DefaultEntryLogger.BufferedLogChannel logChannel)
-
Methods inherited from class org.apache.bookkeeper.bookie.EntryLogManagerBase
createNewLog, flush, flushLogChannel, getRotatedLogChannels, reachEntryLogLimit, readEntryLogHardLimit, selectDirForNextEntryLog
-
-
-
-
Field Detail
-
entryLogsPerLedgerCounter
final EntryLogManagerForEntryLogPerLedger.EntryLogsPerLedgerCounter entryLogsPerLedgerCounter
-
-
Constructor Detail
-
EntryLogManagerForEntryLogPerLedger
EntryLogManagerForEntryLogPerLedger(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, EntryLoggerAllocator entryLoggerAllocator, java.util.List<DefaultEntryLogger.EntryLogListener> listeners, DefaultEntryLogger.RecentEntryLogsStatus recentlyCreatedEntryLogsStatus, StatsLogger statsLogger) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getLock
java.util.concurrent.locks.Lock getLock(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
setCurrentLogForLedgerAndAddToRotate
public void setCurrentLogForLedgerAndAddToRotate(long ledgerId, DefaultEntryLogger.BufferedLogChannel logChannel) throws java.io.IOException
- Specified by:
setCurrentLogForLedgerAndAddToRotate
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
getCurrentLogForLedger
public DefaultEntryLogger.BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws java.io.IOException
- Specified by:
getCurrentLogForLedger
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
getCurrentLogWithDirInfoForLedger
public EntryLogManagerForEntryLogPerLedger.BufferedLogChannelWithDirInfo getCurrentLogWithDirInfoForLedger(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
getCopyOfCurrentLogs
public java.util.Set<EntryLogManagerForEntryLogPerLedger.BufferedLogChannelWithDirInfo> getCopyOfCurrentLogs()
-
getCurrentLogIfPresent
public DefaultEntryLogger.BufferedLogChannel getCurrentLogIfPresent(long entryLogId)
-
checkpoint
public void checkpoint() throws java.io.IOException
- Throws:
java.io.IOException
-
prepareSortedLedgerStorageCheckpoint
public void prepareSortedLedgerStorageCheckpoint(long numBytesFlushed) throws java.io.IOException
- Throws:
java.io.IOException
-
prepareEntryMemTableFlush
public void prepareEntryMemTableFlush()
-
commitEntryMemTableFlush
public boolean commitEntryMemTableFlush() throws java.io.IOException
- Throws:
java.io.IOException
-
doEntryLogMapCleanup
void doEntryLogMapCleanup()
-
getCacheAsMap
java.util.concurrent.ConcurrentMap<java.lang.Long,EntryLogManagerForEntryLogPerLedger.EntryLogAndLockTuple> getCacheAsMap()
-
getDirForNextEntryLog
public java.io.File getDirForNextEntryLog(java.util.List<java.io.File> writableLedgerDirs)
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
forceClose
public void forceClose()
-
flushCurrentLogs
void flushCurrentLogs() throws java.io.IOException
- Specified by:
flushCurrentLogs
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
createNewLogForCompaction
public DefaultEntryLogger.BufferedLogChannel createNewLogForCompaction() throws java.io.IOException
flushCurrentLogs method is called during checkpoint, so metadata of the file also should be force written.- Throws:
java.io.IOException
-
addEntry
public long addEntry(long ledger, io.netty.buffer.ByteBuf entry, boolean rollLog) throws java.io.IOException
- Specified by:
addEntry
in interfaceEntryLogManager
- Overrides:
addEntry
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
createNewLog
void createNewLog(long ledgerId) throws java.io.IOException
- Overrides:
createNewLog
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
getCurrentLogForLedgerForAddEntry
DefaultEntryLogger.BufferedLogChannel getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog) throws java.io.IOException
- Specified by:
getCurrentLogForLedgerForAddEntry
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
flushRotatedLogs
public void flushRotatedLogs() throws java.io.IOException
if disk of the logChannel is full or if the entrylog limit is reached of if the logchannel is not initialized, then createNewLog. If allDisks are full then proceed with the current logChannel, since Bookie must have turned to readonly mode and the addEntry traffic would be from GC and it is ok to proceed in this case.- Specified by:
flushRotatedLogs
in classEntryLogManagerBase
- Throws:
java.io.IOException
-
-