mimaison commented on code in PR #19030: URL: https://github.com/apache/kafka/pull/19030#discussion_r1983053004
########## storage/src/main/java/org/apache/kafka/storage/internals/epoch/LeaderEpochFileCache.java: ########## @@ -200,8 +200,8 @@ public Optional<EpochEntry> latestEntry() { * Returns the current Leader Epoch if one exists. This is the latest epoch * which has messages assigned to it. */ - public OptionalInt latestEpoch() { - return latestEntry().map(epochEntry -> OptionalInt.of(epochEntry.epoch)).orElseGet(OptionalInt::empty); + public Optional<Integer> latestEpoch() { Review Comment: UnifiedLog uses that value to create a `FileRecords.TimestampAndOffset` instance and that constructor accepts `Optional<Integer>`. The original Scala code was converting `OptionalInt` to `Optional<Integer>` in https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/log/UnifiedLog.scala#L1303-L1304 Since there are only 4 callers in main (and 2 in UnifiedLog), I thought it made sense to align the types to avoid these types of conversions. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org