You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2017/05/12 13:43:37 UTC
[44/50] [abbrv] lucene-solr:jira/solr-8668: LUCENE-7817: pass cached
query to onQueryCache instead of null
LUCENE-7817: pass cached query to onQueryCache instead of null
Closes #199
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fb56948e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fb56948e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fb56948e
Branch: refs/heads/jira/solr-8668
Commit: fb56948e70f6468db27d7182add57d338104ba5e
Parents: 30a50ea
Author: ChristophKaser <Ch...@users.noreply.github.com>
Authored: Thu May 11 15:53:51 2017 +0200
Committer: Adrien Grand <jp...@gmail.com>
Committed: Thu May 11 15:56:10 2017 +0200
----------------------------------------------------------------------
lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java | 2 +-
.../core/src/test/org/apache/lucene/search/TestLRUQueryCache.java | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb56948e/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
index 451ce81..e30de03 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
@@ -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;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb56948e/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java b/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
index ee3f4ad..4e80f9e 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
@@ -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);
}