dajac commented on code in PR #13112: URL: https://github.com/apache/kafka/pull/13112#discussion_r1073982833
########## core/src/main/scala/kafka/coordinator/group/GroupMetadataManager.scala: ########## @@ -810,19 +810,22 @@ class GroupMetadataManager(brokerId: Int, */ private def maybeUpdateCoordinatorEpoch( partitionId: Int, - epochOpt: Option[Int] + epochOpt: OptionalInt ): Boolean = { val updatedEpoch = epochForPartitionId.compute(partitionId, (_, currentEpoch) => { if (currentEpoch == null) { - epochOpt.map(Int.box).orNull + if (epochOpt.isPresent) epochOpt.getAsInt + else null } else { - epochOpt match { - case Some(epoch) if epoch > currentEpoch => epoch - case _ => currentEpoch - } + if (epochOpt.isPresent && epochOpt.getAsInt > currentEpoch) epochOpt.getAsInt + else currentEpoch } }) - epochOpt.forall(_ == updatedEpoch) + if(epochOpt.isPresent) { Review Comment: OptionalInt seems better here because we effectively pass an int, no? -- 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