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

Yonik Seeley commented on SOLR-9524:
------------------------------------

bq. I'm also a little sceptical of the claim that multiple threads would be 
attempting to calculate the same fingerprint

When a new leader is elected, I think everyone peersyncs to that leader.
When I originally wrote the code it was just a single fingerprint value (no max 
rolled in), and so it made sense to cache (since the common case is multiple 
replicas asking for the same info around the same time).  After the code was 
modified to use maxversion, it's less clear what the overlap will be, but if 
everyone is already in sync, it should still be high.

> There's a note in IndexFingerprint that // TODO: this could be parallelized, 
> or even cached per-segment if performance becomes an issue, which I think is 
> where we should look instead of trying to ensure that a fingerprint is only 
> calculated once.

I don't see those as exclusive... caching a top-level fingerprint is desirable 
until we have per-segment caching.


> SolrIndexSearcher.getIndexFingerprint uses dubious sunchronization
> ------------------------------------------------------------------
>
>                 Key: SOLR-9524
>                 URL: https://issues.apache.org/jira/browse/SOLR-9524
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 6.3
>            Reporter: Mike Drob
>         Attachments: SOLR-9524.patch
>
>
> In SOLR-9310 we added more code that does some fingerprint caching in 
> SolrIndexSearcher. However, the synchronization looks like it could be made 
> more efficient and may have issues with correctness.
> https://github.com/apache/lucene-solr/blob/branch_6x/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java#L2371-L2385
> Some of the issues:
> * Double checked locking needs use of volatile variables to ensure proper 
> memory semantics.
> * sync on a ConcurrentHashMap is usually a code smell



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to