jolshan commented on a change in pull request #10282:
URL: https://github.com/apache/kafka/pull/10282#discussion_r596377411



##########
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:
       Hmmm. I guess that makes the log creation in makeLeaders/makeFollowers 
superfluous. Another option is to add the partition metadata file in another 
place when we know we have the log associated. We know the log gets associated 
in `partition.createLogIfNotExists` so maybe there? We check if we have an ID 
sent to this request + if we don't yet have a topic ID in the log. and assign 
there? Unfortunately, this is in the raft code path too, but it shouldn't be 
used since we always already assign topic ID.




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


Reply via email to