Class TwoPhaseCompactor


  • public class TwoPhaseCompactor
    extends Compactor
    Compaction will go through the topic in two passes. The first pass selects latest offset for each key in the topic. Then the second pass writes these values to a ledger.

    The two passes are required to avoid holding the payloads of each of the latest values in memory, as the payload can be many orders of magnitude larger than a message id.

    • Constructor Summary

      Constructors 
      Constructor Description
      TwoPhaseCompactor​(org.apache.pulsar.broker.ServiceConfiguration conf, org.apache.pulsar.client.api.PulsarClient pulsar, org.apache.bookkeeper.client.BookKeeper bk, java.util.concurrent.ScheduledExecutorService scheduler)  
    • Constructor Detail

      • TwoPhaseCompactor

        public TwoPhaseCompactor​(org.apache.pulsar.broker.ServiceConfiguration conf,
                                 org.apache.pulsar.client.api.PulsarClient pulsar,
                                 org.apache.bookkeeper.client.BookKeeper bk,
                                 java.util.concurrent.ScheduledExecutorService scheduler)
    • Method Detail

      • doCompaction

        protected java.util.concurrent.CompletableFuture<java.lang.Long> doCompaction​(RawReader reader,
                                                                                      org.apache.bookkeeper.client.BookKeeper bk)
        Specified by:
        doCompaction in class Compactor
      • getPhaseOneLoopReadTimeoutInSeconds

        public long getPhaseOneLoopReadTimeoutInSeconds()