GitHub user benstopford opened a pull request: https://github.com/apache/kafka/pull/2831
MINOR: KAFKA-5036 (points 2, 5): Refactor caching of Latest Epoch This PR covers point (2) and point (5) from KAFKA-5036: 2. Currently, we update the leader epoch in epochCache after log append in the follower but before log append in the leader. It would be more consistent to always do this after log append. This also avoids issues related to failure in log append. 5. The constructor of LeaderEpochFileCache has the following: lock synchronized { ListBuffer(checkpoint.read(): _*) } But everywhere else uses a read or write lock. We should use consistent locking. This is a refactor to the way epochs are cached, replacing the code to cache the latest epoch in the LeaderEpochFileCache by reusing the cached value in Partition. There is no functional change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/benstopford/kafka KAFKA-5036-part2-second-try Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/2831.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2831 ---- commit 3e9c130672824070968173b2991a43eb9fa139b6 Author: Ben Stopford <benstopf...@gmail.com> Date: 2017-04-10T12:56:48Z KAFKA-5036: Refactor the caching of the latest epoch. Workflow is simpler if we resuse the value cached in partition. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---