You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mitalawachat (via GitHub)" <gi...@apache.org> on 2023/07/27 08:01:55 UTC

[GitHub] [kafka] mitalawachat commented on a diff in pull request #14104: Tiered storage | Segment with corrupted index should not be uploaded to remote storage

mitalawachat commented on code in PR #14104:
URL: https://github.com/apache/kafka/pull/14104#discussion_r1275885135


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -599,6 +602,13 @@ private void copyLogSegment(UnifiedLog log, LogSegment segment, long nextSegment
             File logFile = segment.log().file();
             String logFileName = logFile.getName();
 
+            // Corrupted indexes should not be uploaded to remote storage
+            // Example case: Local storage was filled, what caused index corruption
+            // We should avoid uploading such segments
+            segment.timeIndex().sanityCheck();
+            segment.offsetIndex().sanityCheck();
+            segment.txnIndex().sanityCheck();
+
             logger.info("Copying {} to remote storage.", logFileName);

Review Comment:
   > an info log prior to checking indexes would be helpful to understand where the code exited when one of the sanity check fails
   
   `sanityCheck()` throws an exception which contains `file.getAbsolutePath`, and exception should be caught and logged by caller.



-- 
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-unsubscribe@kafka.apache.org

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