sgup432 commented on code in PR #16212:
URL: https://github.com/apache/lucene/pull/16212#discussion_r3454746559


##########
lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java:
##########
@@ -1290,14 +1319,8 @@ public synchronized void cleanUp() {
     keysToClean.removeAll(keysToCleanCopy);
     queriesToClean.removeAll(queriesToCleanCopy);
 
-    for (QueryCacheKey queryCacheKey : keys()) {

Review Comment:
   >read lock still blocks all writers on that partition, so the contention 
concern is the same.
   
   Well its not the same. Read lock does block writers which is fine, but a 
write lock blocks both readers and writers and is more expensive. I do not 
agree with this approach, you can perform a small benchmark and check on this 
yourself. Or have a second opinion on this.
   
   I would still prefer a read lock to create a snapshot of keys, and only take 
write lock when you are actually removing the keys.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to