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



##########
File path: core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
##########
@@ -113,6 +140,20 @@ class KafkaMetadataLog(
     log.truncateTo(offset)
   }
 
+  override def truncateFullyToLatestSnapshot(): Boolean = {

Review comment:
       ```
        at kafka.log.Log.updateHighWatermarkMetadata(Log.scala:463)
        at kafka.log.Log.updateHighWatermark(Log.scala:392)
        at kafka.log.Log.updateLogStartOffset(Log.scala:817)
        at kafka.log.Log.$anonfun$truncateFullyAndStartAt$2(Log.scala:2133)
        at kafka.log.Log.truncateFullyAndStartAt(Log.scala:2362)
        at 
kafka.raft.KafkaMetadataLog.$anonfun$truncateFullyToLatestSnapshot$1(KafkaMetadataLog.scala:149)
        at java.base/java.util.Optional.ifPresent(Optional.java:183)
        at 
kafka.raft.KafkaMetadataLog.truncateFullyToLatestSnapshot(KafkaMetadataLog.scala:146)
   ```
   
   Note that truncate fully will update the high watermark when this function 
returns true. The current signature doesn't have a way to communicate this back 
to the `KafkaRaftClient`. I think we have two choices:
   
   1. Add a `highWatermark` method to the `ReplicatedLog` interface which the 
`KafkaRaftClient` will call after this function returns `true`.
   2. Change this signature to something like `truncateFullyToLatestSnapshot(): 
Optional[Long]` where it will return `Optional.of(hightWatermark)` instead of 
`true`.
   
   I am leaning toward option 1. What do you think @hachikuji ?




----------------------------------------------------------------
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:
[email protected]


Reply via email to