jolshan commented on code in PR #17822:
URL: https://github.com/apache/kafka/pull/17822#discussion_r1843036971
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java:
##########
@@ -339,24 +338,21 @@ private TransactionalRequestResult
beginCompletingTransaction(TransactionResult
if (!newPartitionsInTransaction.isEmpty())
enqueueRequest(addPartitionsToTransactionHandler());
- // If the error is an INVALID_PRODUCER_ID_MAPPING error, the server
will not accept an EndTxnRequest, so skip
- // directly to InitProducerId. Otherwise, we must first abort the
transaction, because the producer will be
- // fenced if we directly call InitProducerId.
- if (!(lastError instanceof InvalidPidMappingException)) {
- EndTxnRequest.Builder builder = new EndTxnRequest.Builder(
- new EndTxnRequestData()
- .setTransactionalId(transactionalId)
- .setProducerId(producerIdAndEpoch.producerId)
- .setProducerEpoch(producerIdAndEpoch.epoch)
- .setCommitted(transactionResult.id),
- isTransactionV2Enabled
- );
+ // We must first abort the transaction, because the producer will be
Review Comment:
I had this thought too. I think we would get the concurrent transactions
error first as we bump the epoch. Then we would need to call init producer ID
again. So I think we do need to make the two calls, but the exact wording here
isn't quite right.
--
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]