showuon commented on code in PR #15026:
URL: https://github.com/apache/kafka/pull/15026#discussion_r1431177323


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -988,13 +985,24 @@ void cleanupExpiredRemoteLogSegments() throws 
RemoteStorageException, ExecutionE
                 return;
             }
 
+            // Cleanup remote log segments and update the log start offset if 
applicable.
+            final Iterator<RemoteLogSegmentMetadata> segmentMetadataIter = 
remoteLogMetadataManager.listRemoteLogSegments(topicIdPartition);
+            if (!segmentMetadataIter.hasNext()) {
+                
brokerTopicStats.topicStats(topicIdPartition.topic()).recordRemoteLogMetadataCount(topicIdPartition.partition(),
 0);
+                logger.debug("No remote log segments available on remote 
storage for partition: {}", topicIdPartition);
+                return;
+            }

Review Comment:
   Move the `listRemoteLogSegments` here so that we can have some cases return 
earlier without running `listRemoteLogSegments`.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to