rreddy-22 commented on code in PR #17402:
URL: https://github.com/apache/kafka/pull/17402#discussion_r1794357870
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java:
##########
@@ -1568,6 +1571,17 @@ public void handleResponse(AbstractResponse response) {
Errors error = endTxnResponse.error();
if (error == Errors.NONE) {
+ // For transaction version 5+, the broker includes the
producerId and producerEpoch in the EndTxnResponse.
+ // KIP-890 Part 2 mandates bumping the epoch after every
transaction. If the epoch overflows,
+ // a new producerId is returned with epoch set to 0.
+ if (isTransactionV2Enabled) {
Review Comment:
I understand that we would rather use the response version to be consistent
with the server but I'm trying to understand when we would be in a situation
where TV2 = true but the EndTxnResponse < 5 or vice versa where TV2 = false and
EndTxnResponse > 5. Afaik it's always a 1:1 mapping but I might be missing
something. Unless it's possible to change the TV mid transaction which I
understand we don't really want to do after my discussion with Artem. Is there
some edge case we want to avoid by using the response version instead of the
flag?
--
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]