junrao commented on a change in pull request #10388: URL: https://github.com/apache/kafka/pull/10388#discussion_r600174178
########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -700,11 +700,13 @@ class Log(@volatile private var _dir: File, case _: NoSuchFileException => error(s"Could not find offset index file corresponding to log file ${segment.log.file.getAbsolutePath}, " + "recovering segment and rebuilding index files...") - recoverSegment(segment) + if (segment.validateSegmentAndRebuildIndices() > 0) Review comment: Another thing is that it's possible for a segment after recovery point to have no index file and also be corrupted. In that case, we want to truncate the data instead of failing with an error. -- 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