hachikuji commented on a change in pull request #9838: URL: https://github.com/apache/kafka/pull/9838#discussion_r553693958
########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -2124,12 +2132,14 @@ class Log(@volatile private var _dir: File, time = time, initFileSize = initFileSize, preallocate = config.preallocate)) - updateLogEndOffset(newOffset) leaderEpochCache.foreach(_.clearAndFlush()) - producerStateManager.truncate() - producerStateManager.updateMapEndOffset(newOffset) + // Clear producer state prior to adjusting log start and end offsets + // in case the first unstable offset is invalidated by the truncation. + producerStateManager.truncateFullyAndStartAt(newOffset) maybeIncrementFirstUnstableOffset() + + updateLogEndOffset(newOffset) updateLogStartOffset(newOffset) Review comment: @junrao Thanks. I tried something like this in the latest commit. Let me know what you think. ---------------------------------------------------------------- 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