jolshan commented on code in PR #21735:
URL: https://github.com/apache/kafka/pull/21735#discussion_r4518615621


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -241,9 +248,14 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
       //      increment it)
       //   3. The expected producer ID matches the previous one and the 
expected epoch is exhausted, in which case this
       //      could be a retry after a valid epoch bump that the producer 
never received the response for
-      txnMetadata.producerEpoch == RecordBatch.NO_PRODUCER_EPOCH ||
-        producerIdAndEpoch.producerId == txnMetadata.producerId ||
-        (producerIdAndEpoch.producerId == txnMetadata.prevProducerId && 
TransactionMetadata.isEpochExhausted(producerIdAndEpoch.epoch))
+      // The checks are done against the client-facing identity: if 
InitProducerId(keepPreparedTxn=true) was used, the
+      // producerId / producerEpoch are frozen to be used for the transaction 
markers.  In that case prevProducerId
+      // refers to the frozen producerId rather than to a previous 
client-facing producer ID, so check 3 doesn't apply

Review Comment:
   nit: it seems like InitProducerId(keepPreparedTxn=true) must always be case 
1 if the expected producer Id is not set?



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