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



##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -2096,10 +2100,14 @@ class Log(@volatile private var _dir: File,
             val deletable = logSegments.filter(segment => segment.baseOffset > 
targetOffset)
             removeAndDeleteSegments(deletable, asyncDelete = true, 
LogTruncation)
             activeSegment.truncateTo(targetOffset)
-            updateLogEndOffset(targetOffset)
-            updateLogStartOffset(math.min(targetOffset, this.logStartOffset))
             leaderEpochCache.foreach(_.truncateFromEnd(targetOffset))
+
+            // Load producer state prior to adjusting log start and end offsets
+            // in case the first unstable offset is invalidated by the 
truncation.
             loadProducerState(targetOffset, reloadFromCleanShutdown = false)

Review comment:
       In the case of requiring truncation below the high watermark, 
```maybeIncrementFirstUnstableOffset``` gets called two times (by 
```loadProducerState``` and ```updateLogEndOffset```). Is first call 
unnecessary?




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