jolshan commented on a change in pull request #11331: URL: https://github.com/apache/kafka/pull/11331#discussion_r715735268
########## File path: core/src/main/scala/kafka/server/KafkaApis.scala ########## @@ -672,29 +672,22 @@ class KafkaApis(val requestChannel: RequestChannel, val versionId = request.header.apiVersion val clientId = request.header.clientId val fetchRequest = request.body[FetchRequest] - val (topicIds, topicNames) = + val topicNames = if (fetchRequest.version() >= 13) - metadataCache.topicIdInfo() + metadataCache.topicIdsToNames() else - (Collections.emptyMap[String, Uuid](), Collections.emptyMap[Uuid, String]()) + Collections.emptyMap[Uuid, String]() - // If fetchData or forgottenTopics contain an unknown topic ID, return a top level error. - var fetchData: util.Map[TopicPartition, FetchRequest.PartitionData] = null - var forgottenTopics: util.List[TopicPartition] = null - try { - fetchData = fetchRequest.fetchData(topicNames) - forgottenTopics = fetchRequest.forgottenTopics(topicNames) - } catch { - case e: UnknownTopicIdException => throw e - } + val fetchData = fetchRequest.fetchData(topicNames) + val forgottenTopics = fetchRequest.forgottenTopics(topicNames) Review comment: We could I suppose? I think the only difference is whether we pass in these values or the fetch request itself (+ topicName map). I don't know if how we handle changes based on context type (besides full/sessionless sessions not having forgotten topics). We could save time translating though if we end up having something like an error session. -- 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