hachikuji commented on code in PR #12032:
URL: https://github.com/apache/kafka/pull/12032#discussion_r847812399
##########
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:
Good questions. Another option I was considering is to call this
`INVALID_REQUEST` since the controller is expected to have the latest leader
epoch. I think `UNKNOWN_LEADER_EPOCH` is typically used in cases where we
expect the failure to be transient.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]