ZOOKEEPER-4919: Make ResponseCache a LRU as it supposed to be#2243
Merged
kezhuw merged 5 commits intoapache:masterfrom Apr 19, 2025
Merged
ZOOKEEPER-4919: Make ResponseCache a LRU as it supposed to be#2243kezhuw merged 5 commits intoapache:masterfrom
kezhuw merged 5 commits intoapache:masterfrom
Conversation
…t uses (the third argument must be true for LRU)
kezhuw
reviewed
Apr 19, 2025
…nseCacheTest.java
…nseCacheTest.java
…nseCacheTest.java
tisonkun
approved these changes
Apr 19, 2025
kezhuw
approved these changes
Apr 19, 2025
Member
|
Merged and backported to 3.9 and 3.8 as it is a bug. @mikkosc Thank you for your contribution! Do you have a jira account so I can assign ZOOKEEPER-4919 to you ? |
Contributor
Author
|
Yes. It seems to be mikko / Mikko Tiihonen. I added comment to the jira to make it obvious |
meszinorbi
pushed a commit
to meszinorbi/zookeeper-up
that referenced
this pull request
Dec 10, 2025
Reviewers: tisonkun, kezhuw Author: mikkosc Closes apache#2243 from mikkosc/fix-lru-cache
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ResponseCache has an inner class called
LRUCache extends LinkedHashMap.But the LinkedHashMap does not work as an LRU unless the third constructor argument is
true.This has basically reduced the caching to work as FIFO, if there are more than cache size elements to query then even popular items would have been dropped from the cache in FIFO insert order.
Added unit test that fails if the LRU cache is not working.