dhruvilshah3 commented on a change in pull request #8936:
URL: https://github.com/apache/kafka/pull/8936#discussion_r451024024



##########
File path: core/src/main/scala/kafka/log/LogSegment.scala
##########
@@ -87,6 +87,12 @@ class LogSegment private[log] (val log: FileRecords,
       // we will recover the segments above the recovery point in recoverLog()
       // in any case so sanity checking them here is redundant.
       txnIndex.sanityCheck()
+      // Failing to sanity check the timeIndex can result in a scenario where 
log segments are
+      // prematurely deleted (before breaching retention periods) if the index 
file was not resized
+      // to disk successfully.
+      // KAFKA-10207
+      timeIndex.sanityCheck()
+      offsetIndex.sanityCheck()

Review comment:
       Did we consider performing the sanity check lazily, eg. when the index 
is loaded for the first time?




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

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


Reply via email to