-
Notifications
You must be signed in to change notification settings - Fork 168
fix(deps): Update com.github.ben-manes.caffeine:caffeine to v3.2.3 + adopt tests #11553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
...torage/cache/src/test/java/org/projectnessie/versioned/storage/cache/TestCacheOvershoot.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // The read of `Eviction` properties is "just" a volatile read since Caffeine 3.2.3 | ||
| // and trigger cleanups asynchronously. Before 3.2.3, cleanups happened synchronously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this upgrade, but I believe it will actually change "prod" code behaviour. Specifically, I expect the test I reported here to result in different memory allocation behaviour.
Do you think it's worth re-running that test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it doesn't hurt re-running that test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
|
Um - so |
…adopt tests The read of `Eviction` properties is "just" a volatile read since Caffeine 3.2.3 and trigger cleanups asynchronously. Before 3.2.3, cleanups happened synchronously. This change breaks the initially present assertions of this test, but not the functionality of the production code. There is sadly no fix possible with Caffeine since 3.2.3. See [this reply](ben-manes/caffeine#1897 (comment)). The workaround I came up with is to change the logic a bit: * If the cache-weight is less than the capacity: just put the entry to the cache, no "special handling". * Otherwise do the following while holding an exclusive lock: * Explicitly trigger cache cleanup * If the cache-weight is less than the admitted capacity (overshooting), put the entry into the cache. * Else, reject and update meters accordingly. We have to allow the "overshooting" to happen to enable (and trigger) the cache cleanup. Otherwise, cleanup would never happen ...
5c83df4 to
72c69d6
Compare
The read of
Evictionproperties is "just" a volatile read since Caffeine 3.2.3 and trigger cleanups asynchronously. Before 3.2.3, cleanups happened synchronously. This change breaks the initially present assertions of this test, but not the functionality of the production code. See ben-manes/caffeine#1897