Class LedgerFragmentReplicator

  • @StatsDoc(name="replication_worker",
              help="Ledger fragment replicator related stats")
    public class LedgerFragmentReplicator
    extends java.lang.Object
    This is the helper class for replicating the fragments from one bookie to another.
    • Method Detail

      • replicate

        void replicate​(LedgerHandle lh,
                       LedgerFragment lf,
                       org.apache.zookeeper.AsyncCallback.VoidCallback ledgerFragmentMcb,
                       java.util.Set<> targetBookieAddresses,
                       java.util.function.BiConsumer<java.lang.Long,​java.lang.Long> onReadEntryFailureCallback)
                throws java.lang.InterruptedException
        This method replicate a ledger fragment which is a contiguous portion of a ledger that was stored in an ensemble that included the failed bookie. It will Splits the fragment into multiple sub fragments by keeping the max entries up to the configured value of rereplicationEntryBatchSize and then it re-replicates that batched entry fragments one by one. After re-replication of all batched entry fragments, it will update the ensemble info with new Bookie once
        lh - LedgerHandle for the ledger
        lf - LedgerFragment to replicate
        ledgerFragmentMcb - MultiCallback to invoke once we've recovered the current ledger fragment.
        targetBookieAddresses - New bookies we want to use to recover and replicate the ledger entries that were stored on the failed bookie.
      • splitIntoSubFragments

        static java.util.Set<LedgerFragment> splitIntoSubFragments​(LedgerHandle lh,
                                                                   LedgerFragment ledgerFragment,
                                                                   long rereplicationEntryBatchSize)
        Split the full fragment into batched entry fragments by keeping rereplicationEntryBatchSize of entries in each one and can treat them as sub fragments.