jeqo commented on code in PR #14727:
URL: https://github.com/apache/kafka/pull/14727#discussion_r1391798949


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -988,30 +997,33 @@ void cleanupExpiredRemoteLogSegments() throws 
RemoteStorageException, ExecutionE
                         return;
                     }
                     RemoteLogSegmentMetadata metadata = 
segmentsIterator.next();
-                    if (segmentsToDelete.contains(metadata)) {
-                        continue;
-                    }
-                    // When the log-start-offset is moved by the user, the 
leader-epoch-checkpoint file gets truncated
-                    // as per the log-start-offset. Until the 
rlm-cleaner-thread runs in the next iteration, those
-                    // remote log segments won't be removed. The 
`isRemoteSegmentWithinLeaderEpoch` validates whether
-                    // the epochs present in the segment lies in the 
checkpoint file. It will always return false
-                    // since the checkpoint file was already truncated.
-                    boolean shouldDeleteSegment = 
remoteLogRetentionHandler.isSegmentBreachByLogStartOffset(
+
+                    if 
(SEGMENT_DELETION_VALID_STATES.contains(metadata.state())) {

Review Comment:
   Agree, applying this fix. 



-- 
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