OmniaGM commented on code in PR #15968:
URL: https://github.com/apache/kafka/pull/15968#discussion_r1831438309
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:
##########
@@ -611,7 +612,10 @@ private void handleProduceResponse(ClientResponse
response, Map<TopicPartition,
// This will be set by completeBatch.
Map<TopicPartition, Metadata.LeaderIdAndEpoch>
partitionsWithUpdatedLeaderInfo = new HashMap<>();
produceResponse.data().responses().forEach(r ->
r.partitionResponses().forEach(p -> {
- TopicPartition tp = new TopicPartition(r.name(),
p.index());
+
+ // Version 12 drop topic name and add support to topic id.
However, metadata can be used to map topic id to topic name.
+ String topicName =
metadata.topicNames().getOrDefault(r.topicId(), r.name());
Review Comment:
I can add validation to check before using topic id however I didn't do this
here as
- metadata has topicIds for long time now
- If `metadata.topicNames()` doesn't have what match `topicId` if it is zero
then `topicName` will fall back to default which is topic `name` provided in
the request.
--
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]