romseygeek commented on code in PR #12614:
URL: https://github.com/apache/lucene/pull/12614#discussion_r1343791876


##########
lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java:
##########
@@ -385,7 +385,9 @@ public void clearQuery(Query query) {
 
   private void onEviction(Query singleton) {
     assert lock.isHeldByCurrentThread();
-    onQueryEviction(singleton, LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY + 
QUERY_DEFAULT_RAM_BYTES_USED);
+    var ramBytesUsedByQuery = LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY;
+    ramBytesUsedByQuery += singleton instanceof Accountable accountableQuery ? 
accountableQuery.ramBytesUsed() : QUERY_DEFAULT_RAM_BYTES_USED;

Review Comment:
   Can we pull this out into a separate `queryRamBytesUsed(Query q)` method, 
given that it's used twice?



-- 
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