mirror of https://github.com/apache/lucene.git
LUCENE-7817: pass cached query to onQueryCache instead of null
Closes #199
This commit is contained in:
parent
30a50eaf83
commit
fb56948e70
|
@ -298,7 +298,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
|
|||
try {
|
||||
Query singleton = uniqueQueries.putIfAbsent(query, query);
|
||||
if (singleton == null) {
|
||||
onQueryCache(singleton, LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY + ramBytesUsed(query));
|
||||
onQueryCache(query, LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY + ramBytesUsed(query));
|
||||
} else {
|
||||
query = singleton;
|
||||
}
|
||||
|
|
|
@ -660,12 +660,14 @@ public class TestLRUQueryCache extends LuceneTestCase {
|
|||
@Override
|
||||
protected void onQueryCache(Query query, long ramBytesUsed) {
|
||||
super.onQueryCache(query, ramBytesUsed);
|
||||
assertNotNull("cached query is null", query);
|
||||
ramBytesUsage.addAndGet(ramBytesUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onQueryEviction(Query query, long ramBytesUsed) {
|
||||
super.onQueryEviction(query, ramBytesUsed);
|
||||
assertNotNull("evicted query is null", query);
|
||||
ramBytesUsage.addAndGet(-ramBytesUsed);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue