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

Noble Paul commented on SOLR-9506:
----------------------------------

Few quick points

{code:java}
  // Map is not concurrent, but since computeIfAbsent is idempotent, it should 
be alright for two threads to compute values for the same key.   
  private final Map<LeafReaderContext, Map<Long, IndexFingerprint>> 
perSegmentFingerprintCache = new WeakHashMap<>();
{code}

The map has to be thread safe, javadocs say that threadsafety depends on the 
map implementation
We really don't need to keep a cache per version. The reason is, we only give 
one version number and only the latest segment will have to have to compute 
anything other than the full fingerprint. As soon as a new segment is added 
everything else other than the full fingerprint becomes useless. So, the 
solution is , if maxVersion is Long.MAX_VALUE, cache it, else recompute 
everytime. So, the cache should be

{code:java}
  private final Map<LeafReaderContext, IndexFingerprint> 
perSegmentFingerprintCache = Collections.synchronizedMap(new WeakHashMap<>());
{code}
 

> cache IndexFingerprint for each segment
> ---------------------------------------
>
>                 Key: SOLR-9506
>                 URL: https://issues.apache.org/jira/browse/SOLR-9506
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Noble Paul
>         Attachments: SOLR-9506_POC.patch
>
>
> The IndexFingerprint is cached per index searcher. it is quite useless during 
> high throughput indexing. If the fingerprint is cached per segment it will 
> make it vastly more efficient to compute the fingerprint



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to