benwtrent commented on code in PR #13306:
URL: https://github.com/apache/lucene/pull/13306#discussion_r1581084470


##########
lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java:
##########
@@ -265,7 +269,6 @@ boolean requiresEviction() {
   }
 
   CacheAndCount get(Query key, IndexReader.CacheHelper cacheHelper) {
-    assert lock.isHeldByCurrentThread();
     assert key instanceof BoostQuery == false;
     assert key instanceof ConstantScoreQuery == false;
     final IndexReader.CacheKey readerKey = cacheHelper.getKey();

Review Comment:
   I am currently trying to read through all the weird concurrency paths here. 
It's tricky to get correct.
   
   `IdentityHashMap` is required still for the `Map<IndexReader.CacheKey, 
LeafCache>`. Changing to any other map will change behavior as now 
`IndexReader.CacheKey` isn't by object identity only, but object equality. This 
is a change to caching behavior. 
   
   
   `uniqueQueries` is used for the LRU portion of the cache, and the class key 
set is provided in `mostRecentlyUsedQueries`. Consequently, on `get` for 
`uniqueQueries`, that is a structural modification of the LinkedHashMap.
   
   Then once we get the query, we look in `cache` with just a `get` on that 
map. This is NOT a structural modification for an IdentityHashMap. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to