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


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -442,6 +477,12 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
               // With TV2, we may be transitioning over a producer epoch 
overflow, and the producer may be using the
               // new producer ID that is still only in pending state.
               Left(Errors.CONCURRENT_TRANSACTIONS)
+            } else if (txnMetadata.hasNextProducerEpoch) {
+              // InitProducerId(keepPreparedTxn=true) kept the ongoing 
transaction, it can only be committed
+              // or aborted, so adding partitions is not allowed regardless of 
the identity in the request
+              // (including the frozen producerId / producerEpoch used for the 
markers).  A well-behaving
+              // client never adds partitions in this state.
+              Left(Errors.INVALID_TXN_STATE)

Review Comment:
   This error code gave us some trouble since most clients don't only treat it 
as fatal, but also may not be able to recover. If we feel confident that this 
is unreachable unless a client is faulty, this is ok. But if there are some 
race conditions that trigger it, it may be worth considering another error like 
fenced.



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