jsancio commented on a change in pull request #9816:
URL: https://github.com/apache/kafka/pull/9816#discussion_r557537324



##########
File path: core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
##########
@@ -113,6 +145,22 @@ class KafkaMetadataLog(
     log.truncateTo(offset)
   }
 
+  override def truncateFullyToLatestSnapshot(): Boolean = {
+    // Truncate the log fully if the latest snapshot is greater than the log 
end offset
+    var truncated = false
+    latestSnapshotId.ifPresent { snapshotId =>
+      if (snapshotId.epoch > log.latestEpoch.getOrElse(0) ||
+        (snapshotId.epoch == log.latestEpoch.getOrElse(0) && snapshotId.offset 
> endOffset().offset)) {
+
+        log.truncateFullyAndStartAt(snapshotId.offset)

Review comment:
       Yes. Up to this point we don't delete any snapshot. I was thinking of 
doing this in a future PR.
   
   https://issues.apache.org/jira/browse/KAFKA-12205




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