hachikuji commented on a change in pull request #9590: URL: https://github.com/apache/kafka/pull/9590#discussion_r610168018
########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -2393,6 +2407,10 @@ class Log(@volatile private var _dir: File, } // okay we are safe now, remove the swap suffix sortedNewSegments.foreach(_.changeFileSuffixes(Log.SwapFileSuffix, "")) + + // If not recovered swap file we need to increment logStartOffset here. Otherwise, we do this when loading the log. + if (!isRecoveredSwapFile) + maybeIncrementLogStartOffset(segments.firstEntry.getValue.baseOffset, LogCompaction) Review comment: What I am referring to is the use of the `LogCompaction` reason passed to `maybeIncrementLogStartOffset`. I believe this logic also applies when splitting a segment and that does not involve compaction. -- 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