rreddy-22 opened a new pull request, #23804: URL: https://github.com/apache/kafka/pull/23804
Backport of #23630 to 4.3 (cherry-pick of 9dfd65db3d5bb3297f29a4a5dea4207658511cd9). After a broker loses leadership of a `__transaction_state` partition, its `TransactionStateManager` keeps the partition's cache entry until `TransactionCoordinator.onResignation` runs, which happens after the replica has already become a follower. Answers decided purely from that cache are never fenced, so a TV2 EndTxn(COMMIT) that lands in this window can get a fatal `INVALID_TXN_STATE` instead of `NOT_COORDINATOR`. This only uses a cache entry while the local replica still leads the partition at the entry's coordinator epoch, and returns `NOT_COORDINATOR` otherwise so the client rediscovers the new coordinator. **Backport notes:** the production change is identical to trunk; only tests were adapted. Applied cleanly. **Testing:** `./gradlew :core:test --tests 'kafka.coordinator.transaction.*' :core:checkstyleTest` passes on 4.3, including the six new tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
