Class EntryCopierImpl
- java.lang.Object
-
- org.apache.bookkeeper.bookie.datainteg.EntryCopierImpl
-
- All Implemented Interfaces:
EntryCopier
public class EntryCopierImpl extends java.lang.Object implements EntryCopier
Implementation for the EntryCopier interface. Handles the reading of entries from peer bookies.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
EntryCopierImpl.BatchImpl
(package private) static class
EntryCopierImpl.SinBin
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.bookie.datainteg.EntryCopier
EntryCopier.Batch
-
-
Constructor Summary
Constructors Constructor Description EntryCopierImpl(BookieId bookieId, BookieClient bookieClient, LedgerStorage storage, com.google.common.base.Ticker ticker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EntryCopier.Batch
newBatch(long ledgerId, LedgerMetadata metadata)
Start copying a new batch.(package private) static com.google.common.collect.ImmutableSortedMap<java.lang.Long,com.google.common.collect.ImmutableList<java.lang.Integer>>
preferredBookieIndices(BookieId bookieId, LedgerMetadata metadata, java.util.Set<BookieId> errorBookies, long seed)
Generate a map of preferred bookie indices.
-
-
-
Constructor Detail
-
EntryCopierImpl
public EntryCopierImpl(BookieId bookieId, BookieClient bookieClient, LedgerStorage storage, com.google.common.base.Ticker ticker)
-
-
Method Detail
-
newBatch
public EntryCopier.Batch newBatch(long ledgerId, LedgerMetadata metadata) throws java.io.IOException
Description copied from interface:EntryCopier
Start copying a new batch. In general, there should be a batch per ledger.- Specified by:
newBatch
in interfaceEntryCopier
- Throws:
java.io.IOException
-
preferredBookieIndices
static com.google.common.collect.ImmutableSortedMap<java.lang.Long,com.google.common.collect.ImmutableList<java.lang.Integer>> preferredBookieIndices(BookieId bookieId, LedgerMetadata metadata, java.util.Set<BookieId> errorBookies, long seed)
Generate a map of preferred bookie indices. For each ensemble, generate the order in which bookies should be tried for entries, notwithstanding errors. For example, if a e5,w2,a2 ensemble has the bookies: [bookie1, bookie2, bookie3, bookie4, bookie5] and the current bookie is bookie2, then we should return something like: [4, 2, 0, 3] Then when retrieving an entry, even though it is only written to 2, we try the bookie in the order from this list. This will cause more requests to go to the same bookie, which should give us the benefit of read locality. We don't want to simply sort by bookie id, as that would cause the same bookies to be loaded for all ensembles. Bookies which have presented errors are always tried last.
-
-