From 1f41a8c682fffee8b7ef56018c47e7ef247343da Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 13 Aug 2015 22:21:46 +0200 Subject: [PATCH] Don't cache percolator query on loading percolators No need to load catch this query since it's cheap and not reused. If we cache it, it can cause assertions to be tripped since this method is executed during postRecovery phase and might still run while nodes are shutdown in tests. --- .../index/percolator/PercolatorQueriesRegistry.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java b/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java index 3a230d1267f..91ff1de78e7 100644 --- a/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java +++ b/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java @@ -20,6 +20,7 @@ package org.elasticsearch.index.percolator; import org.apache.lucene.index.Term; +import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; import org.apache.lucene.util.BytesRef; @@ -260,7 +261,9 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent imple try (Engine.Searcher searcher = shard.engine().acquireSearcher("percolator_load_queries")) { Query query = new TermQuery(new Term(TypeFieldMapper.NAME, PercolatorService.TYPE_NAME)); QueriesLoaderCollector queryCollector = new QueriesLoaderCollector(PercolatorQueriesRegistry.this, logger, mapperService, indexFieldDataService); - searcher.searcher().search(query, queryCollector); + IndexSearcher indexSearcher = new IndexSearcher(searcher.reader()); + indexSearcher.setQueryCache(null); + indexSearcher.search(query, queryCollector); Map queries = queryCollector.queries(); for (Map.Entry entry : queries.entrySet()) { Query previousQuery = percolateQueries.put(entry.getKey(), entry.getValue());