Skip to content

Commit

Permalink
Fix flaky test IndexStatsIT.testFilterCacheStats. (#5963)
Browse files Browse the repository at this point in the history
This change disables query cache when internally querying for operation uid.
This code path is executed only when assertions are enabled to check if an op already exists in the index.
The current code fetches the searcher using acquireSearcher, which reuses the queryCache and conflicts with tests on the cache.

Signed-off-by: Marc Handalian <handalm@amazon.com>
  • Loading branch information
mch2 authored Feb 1, 2023
1 parent dab77e6 commit a7d3884
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ private boolean assertDocDoesNotExist(final Index index, final boolean allowDele
}
} else {
try (Searcher searcher = acquireSearcher("assert doc doesn't exist", SearcherScope.INTERNAL)) {
searcher.setQueryCache(null);
final long docsWithId = searcher.count(new TermQuery(index.uid()));
if (docsWithId > 0) {
throw new AssertionError("doc [" + index.id() + "] exists [" + docsWithId + "] times in index");
Expand Down

0 comments on commit a7d3884

Please sign in to comment.