hni61223 commented on code in PR #15450:
URL: https://github.com/apache/kafka/pull/15450#discussion_r1510985119


##########
core/src/main/scala/kafka/raft/KafkaMetadataLog.scala:
##########
@@ -677,4 +692,20 @@ object KafkaMetadataLog extends Logging {
       Snapshots.deleteIfExists(logDir, snapshotId)
     }
   }
+
+  trait SnapshotDeletionReason {
+    def logReason(snapshotId: OffsetAndEpoch): Unit
+  }
+
+  final case class RetentionMsBreach() extends SnapshotDeletionReason {
+    override def logReason(snapshotId: OffsetAndEpoch): Unit = {
+      info(s"Marking snapshot $snapshotId for deletion because the age is too 
old")

Review Comment:
   Do you mind give me a hint on how to pass the time difference (i.e., now - 
timestamp) to the `RetentionMsBreanch` function? I tried to modify the 
`shouldClean` function to pass a tuple of (Boolean, Long) to pass the time 
difference as the second factor, but was blocked. Could you give me some hints 
to unblock? Thanks!



##########
core/src/main/scala/kafka/raft/KafkaMetadataLog.scala:
##########
@@ -677,4 +692,20 @@ object KafkaMetadataLog extends Logging {
       Snapshots.deleteIfExists(logDir, snapshotId)
     }
   }
+
+  trait SnapshotDeletionReason {
+    def logReason(snapshotId: OffsetAndEpoch): Unit
+  }
+
+  final case class RetentionMsBreach() extends SnapshotDeletionReason {
+    override def logReason(snapshotId: OffsetAndEpoch): Unit = {
+      info(s"Marking snapshot $snapshotId for deletion because the age is too 
old")

Review Comment:
   Do you mind giving me a hint on how to pass the time difference (i.e., now - 
timestamp) to the `RetentionMsBreanch` function? I tried to modify the 
`shouldClean` function to pass a tuple of (Boolean, Long) to pass the time 
difference as the second factor, but was blocked. Could you give me some hints 
to unblock? Thanks!



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to