Hi Günter,

What is the timestamp of the records?

The difference between the system time on the brokers and the record timestamp is used to decide whether a record segment should be removed because its retention time is exceeded. So if the retention time of the topic is set to 1.5 days, the record timestamp is older than 1.5 days and the record is produced now to the topic, the record might be removed quite quickly from the topic.

Since the removal is done by a dedicated cleaner thread on the brokers and only non-active segments are removed, the removal is not deterministic. That means, that the record might not be removed immediately from the the topic after it was produced. Before the record is removed the current segment that contains the record needs to be rolled and the roll needs to happen before the next scheduled execution of the cleaner thread.

Best,
Bruno


On 13.07.21 12:03, guenterh.lists wrote:
Hi,

we come across a mysterious behavior with Kafka streams clients.
After writing about 40000 messages to a topic, they are suddenly no longer available and the topic is empty. The client is still alive.

We use the following defaults as properties for the topic


         - retention.ms=129600000 # 1.5 days

Other properties are kafka defaults

Changing the retention time property to
- retention.ms=-1
(infinite) the behavior doesn't occur.

Actually we are running the cluster in version 2.7.0 but this happened also in 2.4.x

The behavior isn't always consistent. In 2.4.x it was possible that the behavior occurred with some topics and not with others.

Thanks for any advice that could help us to solve the problem.

Günter



Reply via email to