hachikuji commented on code in PR #12032: URL: https://github.com/apache/kafka/pull/12032#discussion_r856620950
########## core/src/main/scala/kafka/controller/KafkaController.scala: ########## @@ -2348,7 +2348,20 @@ class KafkaController(val config: KafkaConfig, controllerContext.partitionLeadershipInfo(tp) match { case Some(leaderIsrAndControllerEpoch) => val currentLeaderAndIsr = leaderIsrAndControllerEpoch.leaderAndIsr - if (newLeaderAndIsr.leaderRecoveryState == LeaderRecoveryState.RECOVERING && newLeaderAndIsr.isr.length > 1) { + if (newLeaderAndIsr.leaderEpoch < currentLeaderAndIsr.leaderEpoch) { + partitionResponses(tp) = Left(Errors.FENCED_LEADER_EPOCH) + None + } else if (newLeaderAndIsr.leaderEpoch > currentLeaderAndIsr.leaderEpoch) { + partitionResponses(tp) = Left(Errors.UNKNOWN_LEADER_EPOCH) Review Comment: So what I ended up doing is using `FENCED_LEADER_EPOCH` for any case where the leader epoch does not match the current value. This is consistent with `ReplicationControlManager` and it is already handled on the broker side in `Partition` (unlike `UKNOWN_LEADER_EPOCH`). -- 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