rreddy-22 opened a new pull request, #23884:
URL: https://github.com/apache/kafka/pull/23884

   Backport of #23831 to 4.3 (cherry-pick of 
814cfa34ebd4b13e09b5eef7782f99bd82f1e9ea).
   
   With transaction V2, an EndTxn(COMMIT) at the current epoch on a transaction 
in Empty, CompleteCommit or CompleteAbort state returned a fatal 
`INVALID_TXN_STATE`. A coordinator that has lost leadership but not yet applied 
the metadata change sees the transaction in exactly this state, since its 
partitions were added on the new coordinator. This commits an empty transaction 
instead, the same way TV2 already handles an empty abort: bump the epoch, write 
PrepareCommit with no partitions and complete it without markers. A stale 
coordinator cannot replicate that `acks=-1` write, so the client gets a 
retriable error and commits on the new coordinator.
   
   **Backport notes:** the production change is identical to trunk. The only 
conflict: on 4.3 `TransactionMetadataTest` is still the Scala test in `core`, 
so `testTransitFromNoOngoingTransactionToPrepareCommitAndCompleteCommitInV2` 
was ported there instead of the Java test.
   
   **Testing:** `./gradlew :core:test --tests 'kafka.coordinator.transaction.*' 
:core:checkstyleTest :transaction-coordinator:test 
:transaction-coordinator:checkstyleMain` passes on 4.3, including all new and 
renamed tests.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   Reviewers: Justine Olshan <[email protected]>
   


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