Package org.apache.pulsar.compaction
Class TwoPhaseCompactor
- java.lang.Object
-
- org.apache.pulsar.compaction.Compactor
-
- org.apache.pulsar.compaction.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.
-
-
Field Summary
-
Fields inherited from class org.apache.pulsar.compaction.Compactor
COMPACTION_SUBSCRIPTION, conf, mxBean, scheduler
-
-
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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletableFuture<java.lang.Long>doCompaction(RawReader reader, org.apache.bookkeeper.client.BookKeeper bk)longgetPhaseOneLoopReadTimeoutInSeconds()
-
-
-
Method Detail
-
doCompaction
protected java.util.concurrent.CompletableFuture<java.lang.Long> doCompaction(RawReader reader, org.apache.bookkeeper.client.BookKeeper bk)
- Specified by:
doCompactionin classCompactor
-
getPhaseOneLoopReadTimeoutInSeconds
public long getPhaseOneLoopReadTimeoutInSeconds()
-
-