You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/01 07:58:50 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #9663: MINOR: Small cleanups in `AlterIsr` handling logic

chia7712 commented on a change in pull request #9663:
URL: https://github.com/apache/kafka/pull/9663#discussion_r533126745



##########
File path: core/src/main/scala/kafka/cluster/Partition.scala
##########
@@ -1372,23 +1390,27 @@ class Partition(val topicPartition: TopicPartition,
    * Since our error was non-retryable we are okay staying in this state until we see new metadata from UpdateMetadata
    * or LeaderAndIsr
    */
-  private def handleAlterIsrResponse(proposedIsr: Set[Int], result: Either[Errors, LeaderAndIsr]): Unit = {
+  private def handleAlterIsrResponse(proposedIsrState: IsrState, result: Either[Errors, LeaderAndIsr]): Unit = {

Review comment:
       Could we rewrite it by currying?
   
   *Before*
   ```scala
       val callbackPartial = handleAlterIsrResponse(proposedIsrState, _ : Either[Errors, LeaderAndIsr])
   
       if (!alterIsrManager.enqueue(AlterIsrItem(topicPartition, newLeaderAndIsr, callbackPartial))) {
         throw new IllegalStateException(s"Failed to enqueue `AlterIsr` request with state " +
           s"$newLeaderAndIsr for partition $topicPartition")
       }
   ```
   
   *After*
   ```scala
   
       if (!alterIsrManager.enqueue(AlterIsrItem(topicPartition, newLeaderAndIsr, handleAlterIsrResponse(proposedIsrState)))) {
         throw new IllegalStateException(s"Failed to enqueue `AlterIsr` request with state " +
           s"$newLeaderAndIsr for partition $topicPartition")
       }
   ```




----------------------------------------------------------------
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:
users@infra.apache.org