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


##########
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:
   Thinking about the case of Unknown_topic_ID made me notice, we have the 
metadata check here only (when creating the `txnOffsetCommitHandler`) , but all 
the retry logic relies on re-enqueueing the same handler, so this won't be 
triggered on retries I expect (would re-send the same topic-id if we get 
unknown_topic_id?).  
   
   Is the intention to handle that when processing the Unknown_topic_id? 
(separate PR?)



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