doc-exports/docs/dms/umn/kafka-faq-200708001.html
Chen, Junjie ca9677b121 DMS UMN 20230201 Version
Reviewed-by: Antonova, Ekaterina <ekantono@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2024-07-22 13:20:04 +00:00

16 lines
2.2 KiB
HTML

<a name="kafka-faq-200708001"></a><a name="kafka-faq-200708001"></a>
<h1 class="topictitle1">Why Do Messages Still Exist After the Retention Period Elapses?</h1>
<div id="body1594171336851"><p id="kafka-faq-200708001__p8060118">If the aging time has been set for a topic, the value of the <strong id="kafka-faq-200708001__b1490419714014">log.retention.hours</strong> parameter does not take effect for the topic. The value of the <strong id="kafka-faq-200708001__b618893774012">log.retention.hours</strong> parameter takes effect only if the aging time has not been set for the topic.</p>
<p id="kafka-faq-200708001__p1263184311111"><strong id="kafka-faq-200708001__b68713347347">Possible cause 1</strong>: Each partition of a topic consists of multiple segment files of the same size (500 MB). When the size of messages stored in a segment file reaches 500 MB, another segment file is created. Kafka deletes segment files instead of messages. Kafka requires that at least one segment file be reserved for storing messages. If the segment file in use contains aged messages, the segment file will not be deleted. Therefore, the aged messages will remain.</p>
<p id="kafka-faq-200708001__p183959217209"><strong id="kafka-faq-200708001__b149442157237">Solution:</strong> Wait until the segment is no longer in use or delete the topic where messages have reached their retention period.</p>
<p id="kafka-faq-200708001__p1958173122018"><strong id="kafka-faq-200708001__b51761441337">Possible cause 2</strong>: In a topic, there is a message whose <strong id="kafka-faq-200708001__b146681117153418">CreateTime</strong> is a future time. For example, assume that it is January 1, and the <strong id="kafka-faq-200708001__b86552578348">CreateTime</strong> is February 1. The message will not be aged after 72 hours from now. As a result, messages created subsequently will also not be aged.</p>
<p id="kafka-faq-200708001__p5506153813201"><strong id="kafka-faq-200708001__b537045154517">Solution</strong>: Delete the topic where the <strong id="kafka-faq-200708001__b181473314307">CreateTime</strong> of a message is a future time.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kafka-faq-190416001.html">Messages</a></div>
</div>
</div>