You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "rreddy-22 (via GitHub)" <gi...@apache.org> on 2026/10/13 16:31:36 UTC

[PR] KAFKA-21181: Return NOT_COORDINATOR from a stale transaction coordinator cache (4.0) [kafka]

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

   Backport of #23630 to 4.0 (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. In addition to the 4.1 adaptations, the new tests use 4.0's Scala `TransactionState` objects (`Empty`, `Ongoing`, `CompleteCommit`), its `Pool`-based transaction cache and its `handleInitProducerId` signature (no 2PC parameters), and `prepareForTxnMessageAppend` keys the response by `TopicPartition`.
   
   **Testing:** `./gradlew :core:test --tests 'kafka.coordinator.transaction.*' :core:checkstyleTest` passes on 4.0, 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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-21181: Return NOT_COORDINATOR from a stale transaction coordinator cache (4.0) [kafka]

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan merged PR #23807:
URL: https://github.com/apache/kafka/pull/23807


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org