suzhiking commented on code in PR #23204:
URL: https://github.com/apache/kafka/pull/23204#discussion_r3883095635
##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -738,10 +739,17 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
+----------------+-------+---------+-------+---------+
| Empty | PF | EB | PF | ITS |
+----------------+-------+---------+-------+---------+
- | CompleteAbort | NONE | EB | ITS | ITS |
+ | CompleteAbort | NONE | EB | IPE | ITS |
+----------------+-------+---------+-------+---------+
| CompleteCommit | ITS | EB | NONE | ITS |
+----------------+-------+---------+-------+---------+
+
+ CompleteAbort + Commit + Retry returns IPE rather than ITS because the
coordinator may abort an open
+ transaction on its own (e.g. when it exceeds transaction.timeout.ms),
bumping the epoch without the
+ producer's knowledge. A commit that was already in flight when such an
abort completed arrives with the
+ pre-abort epoch and is indistinguishable from a retry. The commit is
guaranteed not to have taken effect,
+ so the recoverable INVALID_PRODUCER_EPOCH is returned, matching the
transaction V1 behavior for this race,
Review Comment:
Thanks. That's my bad wording, V1 does not return IPE, "matching the
transaction V1 behavior" is supposed to mean V1 returns PF, which gets handled
the same as IPE by client.
I picked IPE here to (a) tell the same story as the produce path for the
same event, and (b) keep the semantic distinction: PF implies a newer producer
took the transactional.id, which isn't what happened in a timeout abort. On the
`EndTxn` response path the client already folds IPE into
`ProducerFencedException` (`EndTxnHandler`), so the two codes behave
identically for all TV2 clients. I can change it to PF if you'd prefer that.
--
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]