[
https://issues.apache.org/jira/browse/KAFKA-20091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kamal Chandraprakash resolved KAFKA-20091.
------------------------------------------
Resolution: Fixed
> Fix inconsistency in time-based retention checks between remote and local
> segment deletion logic.
> --------------------------------------------------------------------------------------------------
>
> Key: KAFKA-20091
> URL: https://issues.apache.org/jira/browse/KAFKA-20091
> Project: Kafka
> Issue Type: Task
> Components: Tiered-Storage
> Reporter: fujian
> Assignee: fujian
> Priority: Minor
> Fix For: 4.3.0
>
>
> When currentTime- largestTimestamp of segment = retentionMs, the behavior is
> different:
> # Local Segment delete: *Not delete*
> org.apache.kafka.storage.internals.log.UnifiedLog#deleteRetentionMsBreachedSegments:
> boolean delete = startMs - segment.largestTimestamp() > retentionMs;
> 2. Remote segement delete: *Delete*
> org.apache.kafka.server.log.remote.storage.RemoteLogManager.RLMExpirationTask.RemoteLogRetentionHandler#isSegmentBreachedByRetentionTime
> shouldDeleteSegment = metadata.maxTimestampMs() <=
> retentionTimeData.get().cleanupUntilMs;
> //cleanupUntilMs is time.milliseconds() - retentionMs;
> private Optional<RetentionTimeData> buildRetentionTimeData(long retentionMs)
> { long cleanupUntilMs = time.milliseconds() - retentionMs; return retentionMs
> > -1 && cleanupUntilMs >= 0 ? Optional.of(new RetentionTimeData(retentionMs,
> cleanupUntilMs)) : Optional.empty(); }
> The PR: https://github.com/apache/kafka/pull/21352
--
This message was sent by Atlassian Jira
(v8.20.10#820010)