chia7712 commented on a change in pull request #10269: URL: https://github.com/apache/kafka/pull/10269#discussion_r588138822
########## File path: core/src/main/scala/kafka/server/KafkaApis.scala ########## @@ -811,31 +821,40 @@ class KafkaApis(val requestChannel: RequestChannel, .setRecords(data.records) .setPreferredReadReplica(data.preferredReadReplica.getOrElse(FetchResponse.INVALID_PREFERRED_REPLICA_ID)) data.divergingEpoch.foreach(partitionData.setDivergingEpoch) - partitions.put(tp, partitionData) + addPartition(tp.topic, partitionData) } - erroneous.foreach { case (tp, data) => partitions.put(tp, data) } - - var unconvertedFetchResponse: FetchResponse = null + erroneous.foreach { case (tp, data) => addPartition(tp.topic, data) } - def createResponse(throttleTimeMs: Int): FetchResponse = { + def createResponse(unconvertedFetchResponse: FetchResponse, throttleTimeMs: Int): FetchResponse = { // Down-convert messages for each partition if required - val convertedData = new util.LinkedHashMap[TopicPartition, FetchResponseData.PartitionData] - unconvertedFetchResponse.responseData.forEach { (tp, unconvertedPartitionData) => - val error = Errors.forCode(unconvertedPartitionData.errorCode) - if (error != Errors.NONE) - debug(s"Fetch request with correlation id ${request.header.correlationId} from client $clientId " + - s"on partition $tp failed due to ${error.exceptionName}") - convertedData.put(tp, maybeConvertFetchedData(tp, unconvertedPartitionData)) + val convertedResponse = new FetchResponseData() Review comment: done ---------------------------------------------------------------- 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: us...@infra.apache.org