jolshan commented on a change in pull request #11126: URL: https://github.com/apache/kafka/pull/11126#discussion_r678598522
########## File path: core/src/main/scala/kafka/server/ReplicaManager.scala ########## @@ -1405,11 +1393,28 @@ class ReplicaManager(val config: KafkaConfig, s"leader epoch $currentLeaderEpoch") responseMap.put(topicPartition, Errors.STALE_CONTROLLER_EPOCH) } else { - stateChangeLogger.info(s"Ignoring LeaderAndIsr request from " + - s"controller $controllerId with correlation id $correlationId " + - s"epoch $controllerEpoch for partition $topicPartition since its associated " + - s"leader epoch $requestLeaderEpoch matches the current leader epoch") - responseMap.put(topicPartition, Errors.STALE_CONTROLLER_EPOCH) + // The controller may send LeaderAndIsr to upgrade to using topic IDs without bumping the epoch. + val error = requestTopicId match { + case Some(topicId) if partition.log.isEmpty => + // We wanted to assign the topic ID to the log, but the log was unavailable. + stateChangeLogger.info(s"Tried to update log for $topicPartition to assign topic ID " + + s"$topicId from LeaderAndIsr request from controller $controllerId with correlation" + + s" id $correlationId epoch $controllerEpoch") + Errors.KAFKA_STORAGE_ERROR Review comment: I'm not sure I follow here. The result of localLogOrException in makeLeader/makeFollower ~is catching the NotLeader to return KAFKA_STORAGE_ERROR. The only difference is the throwing of the error.~ ~If we were to use localLogOrException, I think we would still need to catch it and return KAFKA_STORAGE_ERROR. I can do that if it makes more sense.~ I believe the same about the epoch matching, and think the only case where we don't have log is when we have a storage error. -- 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