-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-18137: Unloading transaction state incorrectly removes loading …
…partitions (#18011) When there is a become follower transition on a transaction coordinator state partition, we intend to unload the state partition. However, we pass the new epoch to the method that does the unloading. In that method, we create a `TransactionPartitionAndLeaderEpoch` object comprising of the topic partition and the epoch that we use as a key to remove the partition from loading. However, we wouldn't ever expect to see this epoch in that map since we only load on the leader. See the code snippet: https://github.com/apache/kafka/blob/d00f0ecf1a1a082c97564f4b807e7a342472b57a/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L602 We could have a partition load after the unloading occurs, and that partition will be stuck storing stale state on the broker until it restarts. While this may not immediately cause a correctness issue, we should try to properly clean up state. Check that the epoch is less than the new epoch when removing the partition from loadingPartitions. Added a test that failed before this change was made. Reviewers: Artem Livshits <[email protected]>, Jeff Kim <[email protected]>
- Loading branch information
Showing
2 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters