You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Andrzej Bialecki (Jira)" <ji...@apache.org> on 2019/11/12 20:19:00 UTC

[jira] [Comment Edited] (SOLR-13898) Non-atomic use of SolrCache get / put

    [ https://issues.apache.org/jira/browse/SOLR-13898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16972743#comment-16972743 ] 

Andrzej Bialecki edited comment on SOLR-13898 at 11/12/19 8:18 PM:
-------------------------------------------------------------------

Updated patch:

* modify {{SolrIndexSearcher}} {{getDocSet(Query)}} , {{getDocSet(Query, Filter)}} and {{getPositiveDocSet(Query)}} to use {{computeIfAbsent}}.

All tests are passing. If there are no objections I'd like to finish this issue at this stage and track further improvements in new Jira issues.


was (Author: ab):
Updated patch:

* modify {{SolrIndexSearcher}} {{getDocSet(Query)}} , {{getDocSet(Query, Filter)}} and {{getPositiveDocSet(Query)}} to use {{computeIfAbsent}}.

> Non-atomic use of SolrCache get / put
> -------------------------------------
>
>                 Key: SOLR-13898
>                 URL: https://issues.apache.org/jira/browse/SOLR-13898
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 8.3
>            Reporter: Andrzej Bialecki
>            Assignee: Andrzej Bialecki
>            Priority: Major
>             Fix For: 8.4
>
>         Attachments: SOLR-13898.patch, SOLR-13898.patch, SOLR-13898.patch
>
>
> As pointed out by [~ben.manes] in SOLR-13817 Solr code base in many key places uses a similar pattern of non-atomic get / put calls to SolrCache-s. In multi-threaded environment this leads to cache misses and additional unnecessary computations when competing threads both discover a missing value, non-atomically compute it and update the cache.
> Some of these places are known performance bottlenecks where efficient caching is especially important, such as {{SolrIndexSearcher}}, {{SolrDocumentFetcher}}, {{UninvertedField}} and join queries .
> I propose to add {{SolrCache.computeIfAbsent(key, mappingFunction)}} that will atomically retrieve existing values or compute and update the cache. This will require also changing how the {{SolrCache.get(...)}} is used in many components.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org