lianetm commented on code in PR #22443:
URL: https://github.com/apache/kafka/pull/22443#discussion_r3341874276


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java:
##########
@@ -1243,29 +1249,59 @@ private TxnRequestHandler 
addPartitionsToTransactionHandler() {
     private TxnOffsetCommitHandler 
txnOffsetCommitHandler(TransactionalRequestResult result,
                                                           Map<TopicPartition, 
OffsetAndMetadata> offsets,
                                                           
ConsumerGroupMetadata groupMetadata) {
-        for (Map.Entry<TopicPartition, OffsetAndMetadata> entry : 
offsets.entrySet()) {
-            OffsetAndMetadata offsetAndMetadata = entry.getValue();
-            CommittedOffset committedOffset = new 
CommittedOffset(offsetAndMetadata.offset(),
-                    offsetAndMetadata.metadata(), 
offsetAndMetadata.leaderEpoch());
-            pendingTxnOffsetCommits.put(entry.getKey(), committedOffset);
+        // Resolve topic ids from the metadata cache at request build time.
+        // KafkaProducer.sendOffsetsToTransaction has already ensured the cache
+        // is fresh for these topics, so this is a non-blocking lookup.
+        var topicIds = metadata.topicIds();

Review Comment:
   agreed, makes sense (I was thinking about case 2, deleted)



-- 
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]

Reply via email to