Change kafka topic retention from infinite to finite

Viewed 103

I have kafka topic configured with cleanup.policy=compact and retention.ms=-1 - so infinite retention.

What I want to do is change it, I want the events to be compacted time to time. When I create new topic with following configuration it works fine:

cleanup.policy=compact
config retention.ms=5000
min.cleanable.dirty.ratio=0
segment.ms=1000

When I produce events to such topic it is compacted as expected.

Problem is when I have topic with retention set to infinite (-1), and change it's config by kafka-configs --alter. Using kafka-topics --describe I can verify that the changes were successful, but the topic is not compacted. How can I "trigger" those config changes? I also tried restarting the broker and zookeeper, but it didn't do the trick.

I'm using kafka 2.7.0

0 Answers
Related