[ https://issues.apache.org/jira/browse/KAFKA-8534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16862973#comment-16862973 ]
Evelyn Bayes commented on KAFKA-8534: ------------------------------------- Created pull request which adjusts how segments are retained - Kafka-8534 #6932 All thats involved is deleting the segment in bold. private def deleteRetentionSizeBreachedSegments(): Int = { if (config.retentionSize < 0 || size < config.retentionSize) return 0 var diff = size - config.retentionSize def shouldDelete(segment: LogSegment, nextSegmentOpt: Option[LogSegment]) = { if (diff *- segment.size* >= 0) { diff -= segment.size true } else { false } } } > retention.bytes does not work as documented > ------------------------------------------- > > Key: KAFKA-8534 > URL: https://issues.apache.org/jira/browse/KAFKA-8534 > Project: Kafka > Issue Type: Bug > Components: log > Affects Versions: 0.11.0.3, 1.0.2, 1.1.1, 2.0.1, 2.1.1, 2.2.1 > Reporter: Evelyn Bayes > Priority: Major > > A log segment isn't deleted when a partition reaches retention.bytes. > Instead a log segment is deleted when a partition reaches retention.bytes + > segment.bytes > This conflicts with the defenition of retention.bytes: > *_This configuration controls the maximum size a partition (which consists of > log segments) can grow to before we will discard old log segments to free up > space if we are using the "delete" retention policy. By default there is no > size limit only a time limit. Since this limit is enforced at the partition > level, multiply it by the number of partitions to compute the topic retention > in bytes._* -- This message was sent by Atlassian JIRA (v7.6.3#76005)