wyuka commented on a change in pull request #11390: URL: https://github.com/apache/kafka/pull/11390#discussion_r789308168
########## File path: core/src/main/scala/kafka/server/epoch/LeaderEpochFileCache.scala ########## @@ -169,6 +169,24 @@ class LeaderEpochFileCache(topicPartition: TopicPartition, } } + def findPreviousEpoch(epoch: Int): Option[Int] = { + inReadLock(lock) { + Option(epochs.lowerEntry(epoch)).map(_.getKey) Review comment: We can use ``` Option(epochs.lowerKey(epoch)) ``` instead ########## File path: core/src/main/scala/kafka/server/epoch/LeaderEpochFileCache.scala ########## @@ -169,6 +169,24 @@ class LeaderEpochFileCache(topicPartition: TopicPartition, } } + def findPreviousEpoch(epoch: Int): Option[Int] = { + inReadLock(lock) { + Option(epochs.lowerEntry(epoch)).map(_.getKey) + } + } + + def findNextEpoch(epoch: Int): Option[Int] = { + inReadLock(lock) { + Option(epochs.higherEntry(epoch)).map(_.getKey) Review comment: We can use ``` Option(epochs.higherKey(epoch)) ``` instead -- 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