Class EntryCopierImpl

java.lang.Object
org.apache.bookkeeper.bookie.datainteg.EntryCopierImpl
All Implemented Interfaces:
EntryCopier

public class EntryCopierImpl extends Object implements EntryCopier
Implementation for the EntryCopier interface. Handles the reading of entries from peer bookies.
  • Constructor Details

  • Method Details

    • newBatch

      public EntryCopier.Batch newBatch(long ledgerId, LedgerMetadata metadata) throws IOException
      Description copied from interface: EntryCopier
      Start copying a new batch. In general, there should be a batch per ledger.
      Specified by:
      newBatch in interface EntryCopier
      Throws:
      IOException
    • preferredBookieIndices

      static com.google.common.collect.ImmutableSortedMap<Long,com.google.common.collect.ImmutableList<Integer>> preferredBookieIndices(BookieId bookieId, LedgerMetadata metadata, 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.