jolshan commented on code in PR #15968: URL: https://github.com/apache/kafka/pull/15968#discussion_r1643560273
########## clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java: ########## @@ -891,11 +900,20 @@ private void sendProduceRequest(long now, int destination, short acks, int timeo // which is supporting the new magic version to one which doesn't, then we will need to convert. if (!records.hasMatchingMagic(minUsedMagic)) records = batch.records().downConvert(minUsedMagic, 0, time).records(); - ProduceRequestData.TopicProduceData tpData = tpd.find(tp.topic()); + ProduceRequestData.TopicProduceData tpData = canUseTopicId ? + tpd.find(tp.topic(), topicIds.get(tp.topic())) : + tpd.find(new ProduceRequestData.TopicProduceData().setName(tp.topic())); + if (tpData == null) { - tpData = new ProduceRequestData.TopicProduceData().setName(tp.topic()); + tpData = new ProduceRequestData.TopicProduceData(); tpd.add(tpData); } + if (canUseTopicId) { Review Comment: nit: would we also want this in the above block so we don't set each time? -- 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