Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13898

Non-atomic use of SolrCache get / put

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 8.3
    • 8.4
    • None
    • None

    Description

      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.

      Attachments

        1. SOLR-13898.patch
          27 kB
          Andrzej Bialecki
        2. SOLR-13898.patch
          35 kB
          Andrzej Bialecki
        3. SOLR-13898.patch
          39 kB
          Andrzej Bialecki

        Activity

          People

            ab Andrzej Bialecki
            ab Andrzej Bialecki
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: