[ https://issues.apache.org/jira/browse/KAFKA-12571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kowshik Prakasam updated KAFKA-12571: ------------------------------------- Description: *This is a precursor to KAFKA-12553.* Before 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. Once we suitably initialize LeaderEpochFileCache outside Log, we will be able 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 prevents the instantiation of LeaderEpochFileCache outside Log class. This situation blocks the recovery logic (KAFKA-12553) refactor. So this constructor dependency on logEndOffset 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|#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. was: *This is a precursor to KAFKA-12553.* Before 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. Once we suitably initialize LeaderEpochFileCache outside Log, we will be able 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|#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. > 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 > Priority: Major > > *This is a precursor to KAFKA-12553.* > Before 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. Once we suitably initialize LeaderEpochFileCache > outside Log, we will be able 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 prevents the instantiation > of LeaderEpochFileCache outside Log class. > This situation blocks the recovery logic (KAFKA-12553) refactor. So this > constructor dependency on logEndOffset 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|#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)