Merge pull request #13797 from s1monw/remove_index_service_dep
Remove IndexService dep. from IndexShard
This commit is contained in:
commit
5ec7f04021
|
@ -59,7 +59,6 @@ import org.elasticsearch.common.util.concurrent.AbstractRefCounted;
|
||||||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||||
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
||||||
import org.elasticsearch.gateway.MetaDataStateFormat;
|
import org.elasticsearch.gateway.MetaDataStateFormat;
|
||||||
import org.elasticsearch.index.IndexService;
|
|
||||||
import org.elasticsearch.index.VersionType;
|
import org.elasticsearch.index.VersionType;
|
||||||
import org.elasticsearch.index.aliases.IndexAliasesService;
|
import org.elasticsearch.index.aliases.IndexAliasesService;
|
||||||
import org.elasticsearch.index.cache.IndexCache;
|
import org.elasticsearch.index.cache.IndexCache;
|
||||||
|
@ -142,7 +141,6 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
private final ShardPercolateService shardPercolateService;
|
private final ShardPercolateService shardPercolateService;
|
||||||
private final TermVectorsService termVectorsService;
|
private final TermVectorsService termVectorsService;
|
||||||
private final IndexFieldDataService indexFieldDataService;
|
private final IndexFieldDataService indexFieldDataService;
|
||||||
private final IndexService indexService;
|
|
||||||
private final ShardSuggestMetric shardSuggestMetric = new ShardSuggestMetric();
|
private final ShardSuggestMetric shardSuggestMetric = new ShardSuggestMetric();
|
||||||
private final ShardBitsetFilterCache shardBitsetFilterCache;
|
private final ShardBitsetFilterCache shardBitsetFilterCache;
|
||||||
private final DiscoveryNode localNode;
|
private final DiscoveryNode localNode;
|
||||||
|
@ -205,7 +203,7 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
public IndexShard(ShardId shardId, IndexSettingsService indexSettingsService, IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
|
public IndexShard(ShardId shardId, IndexSettingsService indexSettingsService, IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
|
||||||
ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache, IndexAliasesService indexAliasesService,
|
ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache, IndexAliasesService indexAliasesService,
|
||||||
IndicesQueryCache indicesQueryCache, CodecService codecService,
|
IndicesQueryCache indicesQueryCache, CodecService codecService,
|
||||||
TermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService, IndexService indexService,
|
TermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
|
||||||
@Nullable IndicesWarmer warmer, SimilarityService similarityService, EngineFactory factory,
|
@Nullable IndicesWarmer warmer, SimilarityService similarityService, EngineFactory factory,
|
||||||
ClusterService clusterService, ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService) {
|
ClusterService clusterService, ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService) {
|
||||||
super(shardId, indexSettingsService.getSettings());
|
super(shardId, indexSettingsService.getSettings());
|
||||||
|
@ -237,7 +235,6 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
this.shardPercolateService = new ShardPercolateService(shardId, indexSettings);
|
this.shardPercolateService = new ShardPercolateService(shardId, indexSettings);
|
||||||
this.percolatorQueriesRegistry = new PercolatorQueriesRegistry(shardId, indexSettings, queryParserService, indexingService, indicesLifecycle, mapperService, indexFieldDataService, shardPercolateService);
|
this.percolatorQueriesRegistry = new PercolatorQueriesRegistry(shardId, indexSettings, queryParserService, indexingService, indicesLifecycle, mapperService, indexFieldDataService, shardPercolateService);
|
||||||
this.indexFieldDataService = indexFieldDataService;
|
this.indexFieldDataService = indexFieldDataService;
|
||||||
this.indexService = indexService;
|
|
||||||
this.shardBitsetFilterCache = new ShardBitsetFilterCache(shardId, indexSettings);
|
this.shardBitsetFilterCache = new ShardBitsetFilterCache(shardId, indexSettings);
|
||||||
assert clusterService.localNode() != null : "Local node is null lifecycle state is: " + clusterService.lifecycleState();
|
assert clusterService.localNode() != null : "Local node is null lifecycle state is: " + clusterService.lifecycleState();
|
||||||
this.localNode = clusterService.localNode();
|
this.localNode = clusterService.localNode();
|
||||||
|
@ -298,13 +295,7 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
return indexFieldDataService;
|
return indexFieldDataService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapperService mapperService() {
|
public MapperService mapperService() { return mapperService;}
|
||||||
return mapperService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IndexService indexService() {
|
|
||||||
return indexService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShardSearchStats searchService() {
|
public ShardSearchStats searchService() {
|
||||||
return this.searchService;
|
return this.searchService;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.util.BigArrays;
|
import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.index.IndexService;
|
|
||||||
import org.elasticsearch.index.aliases.IndexAliasesService;
|
import org.elasticsearch.index.aliases.IndexAliasesService;
|
||||||
import org.elasticsearch.index.cache.IndexCache;
|
import org.elasticsearch.index.cache.IndexCache;
|
||||||
import org.elasticsearch.index.codec.CodecService;
|
import org.elasticsearch.index.codec.CodecService;
|
||||||
|
@ -61,14 +60,14 @@ public final class ShadowIndexShard extends IndexShard {
|
||||||
IndexQueryParserService queryParserService, IndexCache indexCache,
|
IndexQueryParserService queryParserService, IndexCache indexCache,
|
||||||
IndexAliasesService indexAliasesService, IndicesQueryCache indicesQueryCache,
|
IndexAliasesService indexAliasesService, IndicesQueryCache indicesQueryCache,
|
||||||
CodecService codecService, TermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
|
CodecService codecService, TermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
|
||||||
IndexService indexService, @Nullable IndicesWarmer warmer,
|
@Nullable IndicesWarmer warmer,
|
||||||
SimilarityService similarityService,
|
SimilarityService similarityService,
|
||||||
EngineFactory factory, ClusterService clusterService,
|
EngineFactory factory, ClusterService clusterService,
|
||||||
ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService) throws IOException {
|
ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService) throws IOException {
|
||||||
super(shardId, indexSettingsService, indicesLifecycle, store, storeRecoveryService,
|
super(shardId, indexSettingsService, indicesLifecycle, store, storeRecoveryService,
|
||||||
threadPool, mapperService, queryParserService, indexCache, indexAliasesService,
|
threadPool, mapperService, queryParserService, indexCache, indexAliasesService,
|
||||||
indicesQueryCache, codecService,
|
indicesQueryCache, codecService,
|
||||||
termVectorsService, indexFieldDataService, indexService,
|
termVectorsService, indexFieldDataService,
|
||||||
warmer, similarityService,
|
warmer, similarityService,
|
||||||
factory, clusterService, path, bigArrays, wrappingService);
|
factory, clusterService, path, bigArrays, wrappingService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class IndicesTTLService extends AbstractLifecycleComponent<IndicesTTLServ
|
||||||
|
|
||||||
private void purgeShards(List<IndexShard> shardsToPurge) {
|
private void purgeShards(List<IndexShard> shardsToPurge) {
|
||||||
for (IndexShard shardToPurge : shardsToPurge) {
|
for (IndexShard shardToPurge : shardsToPurge) {
|
||||||
Query query = shardToPurge.indexService().mapperService().smartNameFieldType(TTLFieldMapper.NAME).rangeQuery(null, System.currentTimeMillis(), false, true);
|
Query query = shardToPurge.mapperService().smartNameFieldType(TTLFieldMapper.NAME).rangeQuery(null, System.currentTimeMillis(), false, true);
|
||||||
Engine.Searcher searcher = shardToPurge.acquireSearcher("indices_ttl");
|
Engine.Searcher searcher = shardToPurge.acquireSearcher("indices_ttl");
|
||||||
try {
|
try {
|
||||||
logger.debug("[{}][{}] purging shard", shardToPurge.routingEntry().index(), shardToPurge.routingEntry().id());
|
logger.debug("[{}][{}] purging shard", shardToPurge.routingEntry().index(), shardToPurge.routingEntry().id());
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.analysis.AnalysisService;
|
import org.elasticsearch.index.analysis.AnalysisService;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.cache.query.QueryCache;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
|
@ -750,4 +751,7 @@ public class PercolateContext extends SearchContext {
|
||||||
public Map<Class<?>, Collector> queryCollectors() {
|
public Map<Class<?>, Collector> queryCollectors() {
|
||||||
return queryCollectors;
|
return queryCollectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryCache getQueryCache() { return indexService.cache().query();}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ContextIndexSearcher extends IndexSearcher implements Releasable {
|
||||||
super(searcher.reader());
|
super(searcher.reader());
|
||||||
in = searcher.searcher();
|
in = searcher.searcher();
|
||||||
setSimilarity(searcher.searcher().getSimilarity(true));
|
setSimilarity(searcher.searcher().getSimilarity(true));
|
||||||
setQueryCache(searchContext.indexShard().indexService().cache().query());
|
setQueryCache(searchContext.getQueryCache());
|
||||||
setQueryCachingPolicy(searchContext.indexShard().getQueryCachingPolicy());
|
setQueryCachingPolicy(searchContext.indexShard().getQueryCachingPolicy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.analysis.AnalysisService;
|
import org.elasticsearch.index.analysis.AnalysisService;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.cache.query.*;
|
||||||
|
import org.elasticsearch.index.cache.query.QueryCache;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
|
@ -724,4 +726,7 @@ public class DefaultSearchContext extends SearchContext {
|
||||||
public Map<Class<?>, Collector> queryCollectors() {
|
public Map<Class<?>, Collector> queryCollectors() {
|
||||||
return queryCollectors;
|
return queryCollectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryCache getQueryCache() { return indexService.cache().query();}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.util.BigArrays;
|
import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.index.analysis.AnalysisService;
|
import org.elasticsearch.index.analysis.AnalysisService;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.cache.query.QueryCache;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
|
@ -522,7 +523,8 @@ public abstract class FilteredSearchContext extends SearchContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Class<?>, Collector> queryCollectors() {
|
public Map<Class<?>, Collector> queryCollectors() { return in.queryCollectors();}
|
||||||
return in.queryCollectors();
|
|
||||||
}
|
@Override
|
||||||
|
public QueryCache getQueryCache() { return in.getQueryCache();}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.common.util.iterable.Iterables;
|
import org.elasticsearch.common.util.iterable.Iterables;
|
||||||
import org.elasticsearch.index.analysis.AnalysisService;
|
import org.elasticsearch.index.analysis.AnalysisService;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.cache.query.QueryCache;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
|
@ -368,4 +369,6 @@ public abstract class SearchContext extends DelegatingHasContextAndHeaders imple
|
||||||
*/
|
*/
|
||||||
CONTEXT
|
CONTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract QueryCache getQueryCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class FetchSubPhasePluginIT extends ESIntegTestCase {
|
||||||
hitField = new InternalSearchHitField(NAMES[0], new ArrayList<>(1));
|
hitField = new InternalSearchHitField(NAMES[0], new ArrayList<>(1));
|
||||||
hitContext.hit().fields().put(NAMES[0], hitField);
|
hitContext.hit().fields().put(NAMES[0], hitField);
|
||||||
}
|
}
|
||||||
TermVectorsResponse termVector = context.indexShard().getTermVectors(new TermVectorsRequest(context.indexShard().indexService().index().getName(), hitContext.hit().type(), hitContext.hit().id()));
|
TermVectorsResponse termVector = context.indexShard().getTermVectors(new TermVectorsRequest(context.indexShard().shardId().index().getName(), hitContext.hit().type(), hitContext.hit().id()));
|
||||||
try {
|
try {
|
||||||
Map<String, Integer> tv = new HashMap<>();
|
Map<String, Integer> tv = new HashMap<>();
|
||||||
TermsEnum terms = termVector.getFields().terms(field).iterator();
|
TermsEnum terms = termVector.getFields().terms(field).iterator();
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.analysis.AnalysisService;
|
import org.elasticsearch.index.analysis.AnalysisService;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.cache.query.QueryCache;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
|
@ -665,7 +666,8 @@ public class TestSearchContext extends SearchContext {
|
||||||
public void copyContextAndHeadersFrom(HasContextAndHeaders other) {}
|
public void copyContextAndHeadersFrom(HasContextAndHeaders other) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Class<?>, Collector> queryCollectors() {
|
public Map<Class<?>, Collector> queryCollectors() {return queryCollectors;}
|
||||||
return queryCollectors;
|
|
||||||
}
|
@Override
|
||||||
|
public QueryCache getQueryCache() { return indexService.cache().query();}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue