Package org.apache.pulsar.compaction
Class TwoPhaseCompactor
java.lang.Object
org.apache.pulsar.compaction.Compactor
org.apache.pulsar.compaction.TwoPhaseCompactor
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
ConstructorsConstructorDescriptionTwoPhaseCompactor(org.apache.pulsar.broker.ServiceConfiguration conf, org.apache.pulsar.client.api.PulsarClient pulsar, org.apache.bookkeeper.client.BookKeeper bk, ScheduledExecutorService scheduler) -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletableFuture<Long>doCompaction(RawReader reader, org.apache.bookkeeper.client.BookKeeper bk) long
-
Constructor Details
-
TwoPhaseCompactor
public TwoPhaseCompactor(org.apache.pulsar.broker.ServiceConfiguration conf, org.apache.pulsar.client.api.PulsarClient pulsar, org.apache.bookkeeper.client.BookKeeper bk, ScheduledExecutorService scheduler)
-
-
Method Details
-
doCompaction
protected CompletableFuture<Long> doCompaction(RawReader reader, org.apache.bookkeeper.client.BookKeeper bk) - Specified by:
doCompactionin classCompactor
-
getPhaseOneLoopReadTimeoutInSeconds
public long getPhaseOneLoopReadTimeoutInSeconds()
-