-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store/cache: drop updates to existing items and dedupe get/set methods (
#1142) When an item was successfully updated, metrics and cache size tracking added the new version of the item but did not remove the old version of the item, so it was over-counted. For example, with a fresh cache, if you set the same item m times with each version having entry size n, the cache would think it had m items with current size m*n instead of 1 item with current size n. If you then emptied the cache by evicting every item (only one), the cache would think it had m-1 items with current size (m-1)*n, instead of 0 items with current size 0. This would allow the cache to get stuck in an eviction loop which persists even after the cache has been emptied.
- Loading branch information
1 parent
2b7d70f
commit 01f95bb
Showing
2 changed files
with
151 additions
and
80 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