Kowshik Prakasam created KAFKA-12571: ----------------------------------------
Summary: Eliminate LogEndOffset dependency on LeaderEpochFileCache c'tor Key: KAFKA-12571 URL: https://issues.apache.org/jira/browse/KAFKA-12571 Project: Kafka Issue Type: Sub-task Components: core Reporter: Kowshik Prakasam Assignee: Kowshik Prakasam As a precursor to refactoring the recovery logic (KAFKA-12553), we would like to move the logic to [initialize LeaderEpochFileCache|[https://github.com/apache/kafka/blob/d9bb2ef596343da9402bff4903b129cff1f7c22b/core/src/main/scala/kafka/log/Log.scala#L579]] outside the Log class. This is so that we will be able to suitably initialize LeaderEpochFileCache outside Log and pass it as a dependency into both the Log class constructor and the recovery module. However, the LeaderEpochFileCache constructor takes a [dependency|https://github.com/apache/kafka/blob/d9bb2ef596343da9402bff4903b129cff1f7c22b/core/src/main/scala/kafka/server/epoch/LeaderEpochFileCache.scala#L42] on logEndOffset (via a callback). This dependency blocks the recovery logic (KAFKA-12553) refactor since it prevents the instantiation of LeaderEpochFileCache outside Log class. So this dependency needs to be eliminated. It turns out the logEndOffset dependency is used only in 1 of the LeaderEpochFileCache methods: LeaderEpochFileCache.endOffsetFor, and just for 1 particular [case|[https://github.com/apache/kafka/blob/d9bb2ef596343da9402bff4903b129cff1f7c22b/core/src/main/scala/kafka/server/epoch/LeaderEpochFileCache.scala#L201|https://github.com/apache/kafka/blob/d9bb2ef596343da9402bff4903b129cff1f7c22b/core/src/main/scala/kafka/server/epoch/LeaderEpochFileCache.scala#L201.]]. Therefore, it should be possible to modify this so that we only pass the logEndOffset as a parameter into endOffsetFor whenever the method is called. -- This message was sent by Atlassian Jira (v8.3.4#803005)