dajac commented on a change in pull request #11170: URL: https://github.com/apache/kafka/pull/11170#discussion_r690993461
########## File path: core/src/main/scala/kafka/server/ReplicaManager.scala ########## @@ -1755,6 +1765,78 @@ class ReplicaManager(val config: KafkaConfig, partitionsToMakeFollower } + private def updateTopicIdForFollowers(controllerId: Int, Review comment: Have we considered relying on `makeFollowers` instead of introducing `updateTopicIdForFollowers`? The two methods are really similar. The main notable difference is that `makeFollowers` shutdowns the fetcher thread. We could perhaps optimize this part to not do it if the broker is already a follower for the partition. ########## File path: core/src/main/scala/kafka/server/AbstractFetcherThread.scala ########## @@ -854,6 +859,10 @@ case class PartitionFetchState(fetchOffset: Long, s", delay=${delay.map(_.delayMs).getOrElse(0)}ms" + s")" } + + def updateTopicId(topicId: Option[Uuid]): PartitionFetchState = { + PartitionFetchState(topicId, fetchOffset, lag, currentLeaderEpoch, delay, state, lastFetchedEpoch) Review comment: nit: We could use `this.copy(topicId = topicId`). ########## File path: core/src/main/scala/kafka/server/ReplicaAlterLogDirsThread.scala ########## @@ -262,7 +263,8 @@ class ReplicaAlterLogDirsThread(name: String, private def buildFetchForPartition(tp: TopicPartition, fetchState: PartitionFetchState): ResultWithPartitions[Option[ReplicaFetch]] = { val requestMap = new util.LinkedHashMap[TopicPartition, FetchRequest.PartitionData] val partitionsWithError = mutable.Set[TopicPartition]() - val topicIds = replicaMgr.metadataCache.topicNamesToIds() + val topicId = fetchState.topicId + val topicIds = Collections.singletonMap(tp.topic(), topicId.getOrElse(Uuid.ZERO_UUID)) Review comment: nit: I would bring this one closer to `requestBuilder` as it is only used by the request builder or we could even inline it. -- 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