tinaselenge commented on code in PR #14375:
URL: https://github.com/apache/kafka/pull/14375#discussion_r1428033100


##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -3205,13 +3220,52 @@ class ReplicaManagerTest {
         threadNamePrefix: Option[String],
         quotaManager: ReplicationQuotaManager
       ): ReplicaFetcherManager = {
-        mockReplicaFetcherManager.getOrElse {
-          super.createReplicaFetcherManager(
-            metrics,
-            time,
-            threadNamePrefix,
-            quotaManager
-          )
+          mockReplicaFetcherManager.getOrElse {
+            if (buildRemoteLogAuxState) {
+              super.createReplicaFetcherManager(
+                metrics,
+                time,
+                threadNamePrefix,
+                quotaManager
+              )
+              val config = this.config
+              val metadataCache = this.metadataCache
+              new ReplicaFetcherManager(config, this, metrics, time, 
threadNamePrefix, quotaManager, () => metadataCache.metadataVersion(), () => 1) 
{
+                override def createFetcherThread(fetcherId: Int, sourceBroker: 
BrokerEndPoint): ReplicaFetcherThread = {
+                  val prefix = threadNamePrefix.map(tp => 
s"$tp:").getOrElse("")
+                  val threadName = 
s"${prefix}ReplicaFetcherThread-$fetcherId-${sourceBroker.id}"
+
+                  val tp = new TopicPartition(topic, 0)
+                  val leader = new MockLeaderEndPoint() {
+                    override def fetch(fetchRequest: FetchRequest.Builder): 
Map[TopicPartition, FetchData] = {
+                      Map(tp -> new 
FetchData().setErrorCode(Errors.OFFSET_MOVED_TO_TIERED_STORAGE.code))
+                    }
+                  }
+                  leader.setLeaderState(tp, PartitionState(leaderEpoch = 0))
+                  leader.setReplicaPartitionStateCallback(tp => 
PartitionState(leaderEpoch = 0))
+
+                  val fetcher = new ReplicaFetcherThread(threadName, leader, 
config, failedPartitions, replicaManager,
+                    quotaManager, "", () => config.interBrokerProtocolVersion)
+
+                  val initialFetchState = InitialFetchState(
+                    topicId = Some(Uuid.randomUuid()),
+                    leader = leader.brokerEndPoint(),
+                    currentLeaderEpoch = 0,
+                    initOffset = 0)
+
+                  fetcher.addPartitions(Map(tp -> initialFetchState))
+
+                  fetcher
+                }
+              }
+            } else {
+              super.createReplicaFetcherManager(
+                metrics,
+                time,
+                threadNamePrefix,
+                quotaManager
+              )

Review Comment:
   This cannot be done, due to the mismatching return type. 



-- 
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

Reply via email to