jolshan commented on a change in pull request #10282: URL: https://github.com/apache/kafka/pull/10282#discussion_r596251187
########## File path: core/src/main/scala/kafka/server/ReplicaManager.scala ########## @@ -1369,7 +1377,11 @@ class ReplicaManager(val config: KafkaConfig, val requestLeaderEpoch = partitionState.leaderEpoch val requestTopicId = topicIds.get(topicPartition.topic) - if (!partition.checkOrSetTopicId(requestTopicId)) { + val (topicIdOpt, partitionLogOpt) = partition.topicIdAndLog + if (!checkTopicId(requestTopicId, topicIdOpt, partitionLogOpt)) { Review comment: I suppose one option is to directly associate through Partition.createLogIfNotExists when we get or create the partition a few lines earlier. We call this in makeLeaders/makeFollowers as well, so it's no extra work. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org