jolshan commented on code in PR #21735:
URL: https://github.com/apache/kafka/pull/21735#discussion_r4519207658
##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -927,9 +987,14 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
if (epochAndMetadata.coordinatorEpoch == coordinatorEpoch) {
val txnMetadata = epochAndMetadata.transactionMetadata
txnMetadata.inLock(() => {
- if (txnMetadata.producerId != producerId)
+ // Note that if we did a few
InitProducerId(keepPreparedTxn) the client's producer id
+ // may be different from the producerId (we track it in
the nextProducerId), but at
+ // this point even nextProducerId could be different
from the client's producer id
+ // if we generated a new nextProducerId due to
nextProducerEpoch overflow. So we
+ // check with the copy of the txnMetadata.producerId.
Ditto for the epoch.
+ if (txnMetadata.producerId != producerIdCopy)
Left(Errors.INVALID_PRODUCER_ID_MAPPING)
- else if (txnMetadata.producerEpoch != producerEpoch &&
txnMetadata.producerEpoch != producerEpoch + 1)
+ else if (txnMetadata.producerEpoch != producerEpochCopy
&& txnMetadata.producerEpoch != producerEpochCopy + 1)
Review Comment:
Is this comment really meaning to apply to the short.maxvalue case? It's
surprising we didn't leave a comment before.
--
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]