junrao commented on a change in pull request #8936: URL: https://github.com/apache/kafka/pull/8936#discussion_r465151900
########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -652,6 +653,12 @@ class Log(@volatile private var _dir: File, bytesTruncated } + def segmentRecovery(): LogSegment => Int = { + (segment: LogSegment) => { + recoverSegment(segment, None) Review comment: Well, if we rebuild the index on sanity check failure, the size in memory will be correct and the index is usable. When the index is reloaded after broker restart, the sanity check will fail again and we will rebuild the index again. So, we won't be in a crash loop, but we have the cost of repeatedly rebuilding the index on broker restart. This seems to be the same behavior pre KIP-263. We can log a warning so that people can notice this potential issue. ---------------------------------------------------------------- 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