kamalcph commented on code in PR #18888:
URL: https://github.com/apache/kafka/pull/18888#discussion_r1959056977


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/RemoteIndexCache.java:
##########
@@ -267,8 +267,9 @@ private void init() throws IOException {
         // Delete any .deleted or .tmp files remained from the earlier run of 
the broker.
         try (Stream<Path> paths = Files.list(cacheDir.toPath())) {
             paths.forEach(path -> {
-                if (path.endsWith(LogFileUtils.DELETED_FILE_SUFFIX) ||
-                        path.endsWith(TMP_FILE_SUFFIX)) {
+                String filename = path.getFileName().toString();
+                if (filename.endsWith(LogFileUtils.DELETED_FILE_SUFFIX) ||
+                        filename.endsWith(TMP_FILE_SUFFIX)) {

Review Comment:
   We are checking whether the file endsWith the suffix such as ".deleted" or 
".tmp". Not the actual filename, so the `Path.endsWith` returns false. 
   
   (eg) 
   
   1. Path.endsWith("<offset>_<segment-uuid>.index.deleted") -> returns true
   1. Path.endsWith("deleted") -> returns false
   



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