[
https://issues.apache.org/jira/browse/SOLR-17597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17907493#comment-17907493
]
ASF subversion and git services commented on SOLR-17597:
--------------------------------------------------------
Commit a40826eae6d0dd3b60166844a3be048a6dfee40f in solr's branch
refs/heads/main from Michael Gibney
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=a40826eae6d ]
SOLR-17597: Fix `CaffeineCache.put()` ramBytes decrement (#2917)
> CaffeineCache ramBytes incorrect accounting on `put()`
> ------------------------------------------------------
>
> Key: SOLR-17597
> URL: https://issues.apache.org/jira/browse/SOLR-17597
> Project: Solr
> Issue Type: Bug
> Affects Versions: main (10.0), 9.7
> Reporter: Michael Gibney
> Assignee: Michael Gibney
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> In most cases, usage of {{CaffeineCache.put()}} results in incorrect ramBytes
> accounting. Replaced values (and keys) decrement {{ramBytes}} via
> {{onRemoval()}}, so replaced values currently end up double-decrementing for
> the replaced value in
> [recordRamBytes()|https://github.com/apache/solr/blob/a4229e76771da0125b38204db01ea0934e09c4f4/solr/core/src/java/org/apache/solr/search/CaffeineCache.java#L297-L301].
> After a sufficient number of replacements via {{put()}}, {{ramBytes}} becomes
> permanently negative, and is thus useless.
> The problem was masked in existing tests due to the behavior of the Caffeine
> library in the case of reference equality between the old (replaced) value
> and the new (replacement) value for the same ({{.equals()}}) key -- [the case
> exercised in existing
> tests|https://github.com/apache/solr/blob/a4229e76771da0125b38204db01ea0934e09c4f4/solr/core/src/test/org/apache/solr/search/TestCaffeineCache.java#L342-L345]
> -- in which case {{onRemoval()}} is _not_ invoked (so there is no double
> decrement).
> The problem is also masked in normal usage, since existing/default cache
> implementations and invocation all currently use {{computeIfAbsent()}}
> instead of {{put()}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]