Package org.apache.bookkeeper.meta
Class LegacyHierarchicalLedgerManager
- java.lang.Object
- 
- org.apache.bookkeeper.meta.AbstractZkLedgerManager
- 
- org.apache.bookkeeper.meta.AbstractHierarchicalLedgerManager
- 
- org.apache.bookkeeper.meta.LegacyHierarchicalLedgerManager
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable,- LedgerManager,- org.apache.zookeeper.Watcher
 
 class LegacyHierarchicalLedgerManager extends AbstractHierarchicalLedgerManager Hierarchical Ledger Manager which manages ledger meta in zookeeper using 2-level hierarchical znodes.LegacyHierarchicalLedgerManager splits the generated id into 3 parts (2-4-4): <level1 (2 digits)><level2 (4 digits)><level3 (4 digits)> These 3 parts are used to form the actual ledger node path used to store ledger metadata:(ledgersRootPath)/level1/level2/L(level3) E.g Ledger 0000000001 is split into 3 parts 00, 0000, 0001, which is stored in (ledgersRootPath)/00/0000/L0001. So each znode could have at most 10000 ledgers, which avoids errors during garbage collection due to lists of children that are too long.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.bookkeeper.meta.AbstractZkLedgerManagerAbstractZkLedgerManager.ReadLedgerMetadataTask
 - 
Nested classes/interfaces inherited from interface org.apache.bookkeeper.meta.LedgerManagerLedgerManager.LedgerRange, LedgerManager.LedgerRangeIterator
 
- 
 - 
Field SummaryFields Modifier and Type Field Description (package private) static java.lang.StringIDGEN_ZNODE(package private) static org.slf4j.LoggerLOG- 
Fields inherited from class org.apache.bookkeeper.meta.AbstractZkLedgerManagerconf, ledgerRootPath, listeners, scheduler, zk, ZK_CONNECT_BACKOFF_MS
 
- 
 - 
Constructor SummaryConstructors Constructor Description LegacyHierarchicalLedgerManager(AbstractConfiguration conf, org.apache.zookeeper.ZooKeeper zk)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidasyncProcessLedgers(BookkeeperInternalCallbacks.Processor<java.lang.Long> processor, org.apache.zookeeper.AsyncCallback.VoidCallback finalCb, java.lang.Object context, int successRc, int failureRc)Loop to process all ledgers.longgetLedgerId(java.lang.String pathName)Get ledger id from its znode ledger path.protected java.lang.StringgetLedgerParentNodeRegex()regex expression for name of top level parent znode for ledgers (in HierarchicalLedgerManager) or znode of a ledger (in FlatLedgerManager).java.lang.StringgetLedgerPath(long ledgerId)Get the znode path that is used to store ledger metadata.LedgerManager.LedgerRangeIteratorgetLedgerRanges(long zkOpTimeoutMs)Loop to scan a range of metadata from metadata storage.- 
Methods inherited from class org.apache.bookkeeper.meta.AbstractHierarchicalLedgerManagerasyncProcessLevelNodes, getLedgerId, ledgerListToSet
 - 
Methods inherited from class org.apache.bookkeeper.meta.AbstractZkLedgerManagerasyncProcessLedgersInSingleNode, close, createLedgerMetadata, isLeadgerIdGeneratorZnode, isLedgerParentNode, isSpecialZnode, process, readLedgerMetadata, readLedgerMetadata, registerLedgerMetadataListener, removeLedgerMetadata, unregisterLedgerMetadataListener, writeLedgerMetadata
 
- 
 
- 
- 
- 
Field Detail- 
LOGstatic final org.slf4j.Logger LOG 
 - 
IDGEN_ZNODEstatic final java.lang.String IDGEN_ZNODE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
LegacyHierarchicalLedgerManagerpublic LegacyHierarchicalLedgerManager(AbstractConfiguration conf, org.apache.zookeeper.ZooKeeper zk) Constructor.- Parameters:
- conf- Configuration object
- zk- ZooKeeper Client Handle
 
 
- 
 - 
Method Detail- 
getLedgerPathpublic java.lang.String getLedgerPath(long ledgerId) Description copied from class:AbstractZkLedgerManagerGet the znode path that is used to store ledger metadata.- Specified by:
- getLedgerPathin class- AbstractZkLedgerManager
- Parameters:
- ledgerId- Ledger ID
- Returns:
- ledger node path
 
 - 
getLedgerIdpublic long getLedgerId(java.lang.String pathName) throws java.io.IOExceptionDescription copied from class:AbstractZkLedgerManagerGet ledger id from its znode ledger path.- Specified by:
- getLedgerIdin class- AbstractZkLedgerManager
- Parameters:
- pathName- Ledger path to store metadata
- Returns:
- ledger id
- Throws:
- java.io.IOException- when the ledger path is invalid
 
 - 
asyncProcessLedgerspublic void asyncProcessLedgers(BookkeeperInternalCallbacks.Processor<java.lang.Long> processor, org.apache.zookeeper.AsyncCallback.VoidCallback finalCb, java.lang.Object context, int successRc, int failureRc) Description copied from interface:LedgerManagerLoop to process all ledgers.- 
 After all ledgers were processed, finalCb will be triggerred:
 
- if all ledgers are processed done with OK, success rc will be passed to finalCb.
- if some ledgers are prcoessed failed, failure rc will be passed to finalCb.
 - Parameters:
- processor- Ledger Processor to process a specific ledger
- finalCb- Callback triggered after all ledgers are processed
- context- Context of final callback
- successRc- Success RC code passed to finalCb when callback
- failureRc- Failure RC code passed to finalCb when exceptions occured.
 
 - 
getLedgerParentNodeRegexprotected java.lang.String getLedgerParentNodeRegex() Description copied from class:AbstractZkLedgerManagerregex expression for name of top level parent znode for ledgers (in HierarchicalLedgerManager) or znode of a ledger (in FlatLedgerManager).- Specified by:
- getLedgerParentNodeRegexin class- AbstractZkLedgerManager
- Returns:
 
 - 
getLedgerRangespublic LedgerManager.LedgerRangeIterator getLedgerRanges(long zkOpTimeoutMs) Description copied from interface:LedgerManagerLoop to scan a range of metadata from metadata storage.- Parameters:
- zkOpTimeoutMs- Iterator considers timeout while fetching ledger-range from zk.
- Returns:
- will return a iterator of the Ranges
 
 
- 
 
-