Package org.apache.bookkeeper.bookie
Class IndexPersistenceMgr
java.lang.Object
org.apache.bookkeeper.bookie.IndexPersistenceMgr
A
IndexPersistenceMgr is responsible for managing the persistence state for the index in a bookie.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final SnapshotMap<Long,Boolean> (package private) final int(package private) final FileInfoBackingCache(package private) final LedgerDirsManager(package private) final int(package private) final int(package private) final com.google.common.cache.Cache<Long,FileInfoBackingCache.CachedFileInfo> (package private) static final String(package private) final com.google.common.cache.Cache<Long,FileInfoBackingCache.CachedFileInfo> -
Constructor Summary
ConstructorsConstructorDescriptionIndexPersistenceMgr(int pageSize, int entriesPerPage, ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager, StatsLogger statsLogger) -
Method Summary
Modifier and TypeMethodDescription(package private) voidcancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher) (package private) voidclose()(package private) voidflushLedgerEntries(long l, List<LedgerEntryPage> entries) (package private) voidflushLedgerHeader(long ledger) io.netty.buffer.ByteBufgetExplicitLac(long ledgerId) (package private) FileInfoBackingCache.CachedFileInfogetFileInfo(Long ledger, byte[] masterKey) Get the FileInfo and increase reference count.(package private) LonggetLastAddConfirmed(long ledgerId) static final StringgetLedgerName(long ledgerId) (package private) int(package private) longgetPersistEntryBeyondInMem(long ledgerId, long lastEntryInMem) (package private) booleanisFenced(long ledgerId) (package private) booleanledgerExists(long ledgerId) readLedgerIndexMetadata(long ledgerId) Read ledger meta.(package private) byte[]readMasterKey(long ledgerId) (package private) voidremoveLedger(Long ledgerId) This method is called whenever a ledger is deleted by the BookKeeper Client and we want to remove all relevant data for it stored in the LedgerCache.(package private) voidsetExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac) (package private) booleansetFenced(long ledgerId) (package private) voidsetMasterKey(long ledgerId, byte[] masterKey) (package private) longupdateLastAddConfirmed(long ledgerId, long lac) (package private) booleanUpdate the ledger entry page.(package private) booleanwaitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher)
-
Field Details
-
RLOC
- See Also:
-
writeFileInfoCache
-
readFileInfoCache
-
fileInfoBackingCache
-
openFileLimit
final int openFileLimit -
pageSize
final int pageSize -
entriesPerPage
final int entriesPerPage -
activeLedgers
-
ledgerDirsManager
-
-
Constructor Details
-
IndexPersistenceMgr
public IndexPersistenceMgr(int pageSize, int entriesPerPage, ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager, StatsLogger statsLogger) throws IOException- Throws:
IOException
-
-
Method Details
-
getLedgerName
-
getFileInfo
Get the FileInfo and increase reference count. When we get FileInfo from cache, we need to make sure it is synchronized with eviction, otherwise there might be a race condition as we get the FileInfo from cache, that FileInfo is then evicted and closed before we could even increase the reference counter.- Throws:
IOException
-
removeLedger
This method is called whenever a ledger is deleted by the BookKeeper Client and we want to remove all relevant data for it stored in the LedgerCache.- Throws:
IOException
-
ledgerExists
- Throws:
IOException
-
close
- Throws:
IOException
-
getLastAddConfirmed
- Throws:
IOException
-
waitForLastAddConfirmedUpdate
boolean waitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Throws:
IOException
-
cancelWaitForLastAddConfirmedUpdate
void cancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Throws:
IOException
-
updateLastAddConfirmed
- Throws:
IOException
-
readMasterKey
- Throws:
IOExceptionBookieException
-
setMasterKey
- Throws:
IOException
-
setFenced
- Throws:
IOException
-
isFenced
- Throws:
IOException
-
setExplicitLac
- Throws:
IOException
-
getExplicitLac
public io.netty.buffer.ByteBuf getExplicitLac(long ledgerId) -
getOpenFileLimit
int getOpenFileLimit() -
flushLedgerHeader
- Throws:
IOException
-
flushLedgerEntries
- Throws:
IOException
-
updatePage
Update the ledger entry page.- Parameters:
lep- ledger entry page- Returns:
- true if it is a new page, otherwise false.
- Throws:
IOException
-
getPersistEntryBeyondInMem
- Throws:
IOException
-
readLedgerIndexMetadata
Read ledger meta.- Parameters:
ledgerId- Ledger Id- Throws:
IOException
-