hachikuji commented on code in PR #12181:
URL: https://github.com/apache/kafka/pull/12181#discussion_r894143395


##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -1534,10 +1533,12 @@ class Partition(val topicPartition: TopicPartition,
       partitionEpoch
     )
     val updatedState = PendingExpandIsr(
-      partitionState.isr,
       newInSyncReplicaId,
       newLeaderAndIsr,
-      partitionState
+      // The current partition state must be of type CommittedPartitionState
+      // if we are here. CommittedPartitionState is the only one with 
`isInflight`
+      // equals to false.
+      partitionState.asInstanceOf[CommittedPartitionState]

Review Comment:
   Perhaps a nicer way we can do this is with a `match` in the caller. 
Something like this:
   ```scala
     partitionState match {
       case currentState: CommittedState if needsExpandIsr(followerReplica) => 
         Some(prepareIsrExpand(currentState, followerReplica.brokerId))
       case _ =>
         None 
     }
   ```         



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

Reply via email to