Skip to content

Commit

Permalink
Fix flaky test IndexStatsIT.testFilterCacheStats. (#5963) (#6147)
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.


(cherry picked from commit a7d3884)

Signed-off-by: Marc Handalian <handalm@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7eb179e commit d61942e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,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 d61942e

Please sign in to comment.