kowshik commented on a change in pull request #10280: URL: https://github.com/apache/kafka/pull/10280#discussion_r648978604
########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -1788,17 +1554,9 @@ class Log(@volatile private var _dir: File, maybeHandleIOException(s"Error while truncating the entire log for $topicPartition in dir ${dir.getParent}") { debug(s"Truncate and start at offset $newOffset") lock synchronized { - checkIfMemoryMappedBufferClosed() - removeAndDeleteSegments(logSegments, asyncDelete = true, LogTruncation) - addSegment(LogSegment.open(dir, - baseOffset = newOffset, - config = config, - time = time, - initFileSize = config.initFileSize, - preallocate = config.preallocate)) + localLog.truncateFullyAndStartAt(newOffset) Review comment: Done in 28bf22af168ca0db76796b5d3cd67a38ed8ed1c2. ########## File path: core/src/main/scala/kafka/log/Log.scala ########## @@ -1812,37 +1570,39 @@ class Log(@volatile private var _dir: File, endOffset: Long ): Unit = { logStartOffset = startOffset - nextOffsetMetadata = LogOffsetMetadata(endOffset, activeSegment.baseOffset, activeSegment.size) - recoveryPoint = math.min(recoveryPoint, endOffset) + localLog.updateLogEndOffset(endOffset) rebuildProducerState(endOffset, producerStateManager) - updateHighWatermark(math.min(highWatermark, endOffset)) + if (highWatermark < localLog.logEndOffset) Review comment: Done in 28bf22af168ca0db76796b5d3cd67a38ed8ed1c2. -- 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