jolshan commented on a change in pull request #9590: URL: https://github.com/apache/kafka/pull/9590#discussion_r610179797
########## 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: Ah. I see what you mean. I can add such a reason as well as a parameter for this method. In the case of `completeSwapOperations` I'm a little unsure how we can tell. We can check the number of swap files since cleaning will always make just 1. But I think in the case of splitting, we may also have just 1 if we fail right before handling the last swap file. This seems like a pretty rare case though. -- 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