From e2bf486287e7392fa2ff0edde0e7ad631f828132 Mon Sep 17 00:00:00 2001 From: Boyang Jerry Peng Date: Tue, 28 Jul 2020 10:11:26 -0700 Subject: [PATCH] Allow topic compaction to be disabled in Pulsar Functions (#7677) Co-authored-by: Jerry Peng --- .../org/apache/pulsar/functions/worker/SchedulerManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java index 21961cf8b1b7f..b1ac384a2f0c8 100644 --- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java +++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java @@ -189,7 +189,9 @@ public synchronized void initialize() { new LinkedBlockingQueue<>(5)); executorService.setThreadFactory(new ThreadFactoryBuilder().setNameFormat("worker-scheduler-%d").build()); scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("worker-assignment-topic-compactor")); - scheduleCompaction(this.scheduledExecutorService, workerConfig.getTopicCompactionFrequencySec()); + if (workerConfig.getTopicCompactionFrequencySec() > 0) { + scheduleCompaction(this.scheduledExecutorService, workerConfig.getTopicCompactionFrequencySec()); + } isRunning = true; lastMessageProduced = null;