junrao commented on a change in pull request #9838:
URL: https://github.com/apache/kafka/pull/9838#discussion_r553511584



##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -2124,13 +2132,15 @@ 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()
+
         updateLogStartOffset(newOffset)
+        updateLogEndOffset(newOffset)

Review comment:
       Actually, this is not an issue on second look.




----------------------------------------------------------------
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


Reply via email to