You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by pa...@apache.org on 2021/12/25 18:34:19 UTC

[lucene] branch branch_9x updated: LUCENE-10316: fix TestLRUQueryCache.testCachingAccountableQuery failure (#542)

This is an automated email from the ASF dual-hosted git repository.

patrickz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 6e77890  LUCENE-10316: fix TestLRUQueryCache.testCachingAccountableQuery failure (#542)
6e77890 is described below

commit 6e7789013b76bd9548cbe51684445bb25df8db05
Author: Patrick Zhai <zh...@users.noreply.github.com>
AuthorDate: Tue Dec 21 10:32:02 2021 -0800

    LUCENE-10316: fix TestLRUQueryCache.testCachingAccountableQuery failure (#542)
---
 lucene/CHANGES.txt                                                 | 2 ++
 .../core/src/test/org/apache/lucene/search/TestLRUQueryCache.java  | 7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 238bc24..378ce65 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -86,6 +86,8 @@ Optimizations
 Bug Fixes
 ---------------------
 
+* LUCENE-10316: fix TestLRUQueryCache.testCachingAccountableQuery failure. (Patrick Zhai)
+
 * LUCENE-10279: Fix equals in MultiRangeQuery. (Ignacio Vera)
 
 * LUCENE-10287: Fix Luke startup script to add jdk.unsupported module so
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 c6ee733..648f133 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
@@ -566,10 +566,9 @@ public class TestLRUQueryCache extends LuceneTestCase {
       final Query query = new AccountableDummyQuery();
       searcher.count(query);
     }
-    long queryRamBytesUsed =
-        numQueries * (10 * QUERY_DEFAULT_RAM_BYTES_USED + LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY);
-    // allow 10% error for other ram bytes used estimation inside query cache
-    assertEquals(queryRamBytesUsed, queryCache.ramBytesUsed(), 10 * queryRamBytesUsed / 100);
+    long queryRamBytesUsed = numQueries * (10 * QUERY_DEFAULT_RAM_BYTES_USED);
+    // make sure the query cache reflects the big queries
+    assertTrue(queryCache.ramBytesUsed() > queryRamBytesUsed);
 
     reader.close();
     w.close();