jiafu1115 opened a new pull request, #21352:
URL: https://github.com/apache/kafka/pull/21352

   When currentTime- largestTimestamp of segment = retentionMs, the behavior is 
different:
   
   1. 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();
   }
   ```
   
   
   cc @kamalcph 
   
   Thanks for your comments on 
[KIP-1241](https://cwiki.apache.org/confluence/x/A4LMFw) .
   While I thinking through one of the your comments and reading the code, I 
noticed a potential problem in this area, so I opened this PR. Many thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to