Kafka Offset after retention period

梦想的初衷 提交于 2019-12-10 13:01:06

问题


I have a kafka topic with 1 partition. if it had 100 messages in it the offset would be from 0.99.

According the kafka retention policy all of the messages will be wiped out after the specified period.

and i am sending 100 new messages to the topic once all have been wiped out(after retention period). Now, where would the new offset of the message start from? is it From 100 or from 0??

I am trying to understand whether the new offsets will be 100-199 or 0-99?


回答1:


Kafka honors the log retention policy by deleting log segments which satisfy the predicate and it will not never remove the active log segment which means the base offset of the active log segment will always be kept.

As for your example, if the first batch of 100 messages are all in a same log segment, Kafka will create a new log segment with the base offset of 100 and delete the old segment after a log-retention-period amount of time passed. So a new message starts offset at 100.



来源:https://stackoverflow.com/questions/40251198/kafka-offset-after-retention-period

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!