Don't pull the engine for access to the QueryCachingPolicy
This commit is contained in:
parent
0ae638fbb2
commit
fcbd0dddcd
|
@ -254,7 +254,6 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
cachingPolicy = new UsageTrackingQueryCachingPolicy();
|
cachingPolicy = new UsageTrackingQueryCachingPolicy();
|
||||||
}
|
}
|
||||||
this.engineConfig = newEngineConfig(translogConfig, cachingPolicy);
|
this.engineConfig = newEngineConfig(translogConfig, cachingPolicy);
|
||||||
|
|
||||||
this.indexShardOperationCounter = new IndexShardOperationCounter(logger, shardId);
|
this.indexShardOperationCounter = new IndexShardOperationCounter(logger, shardId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,6 +323,10 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
return this.shardRouting;
|
return this.shardRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryCachingPolicy getQueryCachingPolicy() {
|
||||||
|
return this.engineConfig.getQueryCachingPolicy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the shards routing entry. This mutate the shards internal state depending
|
* Updates the shards routing entry. This mutate the shards internal state depending
|
||||||
* on the changes that get introduced by the new routing value. This method will persist shard level metadata
|
* on the changes that get introduced by the new routing value. This method will persist shard level metadata
|
||||||
|
|
|
@ -372,9 +372,10 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
public QuerySearchResult executeQueryPhase(QuerySearchRequest request) {
|
public QuerySearchResult executeQueryPhase(QuerySearchRequest request) {
|
||||||
final SearchContext context = findContext(request.id());
|
final SearchContext context = findContext(request.id());
|
||||||
contextProcessing(context);
|
contextProcessing(context);
|
||||||
|
IndexShard indexShard = context.indexShard();
|
||||||
try {
|
try {
|
||||||
final IndexCache indexCache = context.indexShard().indexService().cache();
|
final IndexCache indexCache = indexShard.indexService().cache();
|
||||||
final QueryCachingPolicy cachingPolicy = context.indexShard().engine().config().getQueryCachingPolicy();
|
final QueryCachingPolicy cachingPolicy = indexShard.getQueryCachingPolicy();
|
||||||
context.searcher().dfSource(new CachedDfSource(context.searcher().getIndexReader(), request.dfs(), context.similarityService().similarity(),
|
context.searcher().dfSource(new CachedDfSource(context.searcher().getIndexReader(), request.dfs(), context.similarityService().similarity(),
|
||||||
indexCache.query(), cachingPolicy));
|
indexCache.query(), cachingPolicy));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -382,7 +383,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
cleanContext(context);
|
cleanContext(context);
|
||||||
throw new QueryPhaseExecutionException(context, "Failed to set aggregated df", e);
|
throw new QueryPhaseExecutionException(context, "Failed to set aggregated df", e);
|
||||||
}
|
}
|
||||||
ShardSearchStats shardSearchStats = context.indexShard().searchService();
|
ShardSearchStats shardSearchStats = indexShard.searchService();
|
||||||
try {
|
try {
|
||||||
shardSearchStats.onPreQueryPhase(context);
|
shardSearchStats.onPreQueryPhase(context);
|
||||||
long time = System.nanoTime();
|
long time = System.nanoTime();
|
||||||
|
@ -448,8 +449,9 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
final SearchContext context = findContext(request.id());
|
final SearchContext context = findContext(request.id());
|
||||||
contextProcessing(context);
|
contextProcessing(context);
|
||||||
try {
|
try {
|
||||||
final IndexCache indexCache = context.indexShard().indexService().cache();
|
final IndexShard indexShard = context.indexShard();
|
||||||
final QueryCachingPolicy cachingPolicy = context.indexShard().engine().config().getQueryCachingPolicy();
|
final IndexCache indexCache = indexShard.indexService().cache();
|
||||||
|
final QueryCachingPolicy cachingPolicy = indexShard.getQueryCachingPolicy();
|
||||||
context.searcher().dfSource(new CachedDfSource(context.searcher().getIndexReader(), request.dfs(), context.similarityService().similarity(),
|
context.searcher().dfSource(new CachedDfSource(context.searcher().getIndexReader(), request.dfs(), context.similarityService().similarity(),
|
||||||
indexCache.query(), cachingPolicy));
|
indexCache.query(), cachingPolicy));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
Loading…
Reference in New Issue