jsancio commented on a change in pull request #11733:
URL: https://github.com/apache/kafka/pull/11733#discussion_r812044247



##########
File path: core/src/main/scala/kafka/controller/KafkaController.scala
##########
@@ -2263,37 +2271,43 @@ class KafkaController(val config: KafkaConfig,
             .groupBy { case (tp, _) => tp.topic }   // Group by topic
             .foreach { case (topic, partitions) =>
               // Add each topic part to the response
-              val topicResp = new AlterIsrResponseData.TopicData()
+              val topicResp = new AlterPartitionResponseData.TopicData()
                 .setName(topic)
                 .setPartitions(new util.ArrayList())
               resp.topics.add(topicResp)
               partitions.foreach { case (tp, errorOrIsr) =>
                 // Add each partition part to the response (new ISR or error)
                 errorOrIsr match {
                   case Left(error) => topicResp.partitions.add(
-                    new AlterIsrResponseData.PartitionData()
+                    new AlterPartitionResponseData.PartitionData()
                       .setPartitionIndex(tp.partition)
                       .setErrorCode(error.code))
                   case Right(leaderAndIsr) => topicResp.partitions.add(
-                    new AlterIsrResponseData.PartitionData()
+                    new AlterPartitionResponseData.PartitionData()
                       .setPartitionIndex(tp.partition)
                       .setLeaderId(leaderAndIsr.leader)
                       .setLeaderEpoch(leaderAndIsr.leaderEpoch)
                       .setIsr(leaderAndIsr.isr.map(Integer.valueOf).asJava)
-                      .setCurrentIsrVersion(leaderAndIsr.zkVersion))
+                      
.setLeaderRecoveryState(leaderAndIsr.leaderRecoveryState.value)

Review comment:
       It maybe a little subtle but I don't think we need to. If the version is 
`0` then this is guaranteed to be the default value `0` so the serialization 
will succeed. This is true because we only write these values in the response 
when the operation success. If the operation fails then we skip writing these 
values and instead just write the error code.




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


Reply via email to