Fix missing renamings.

Relates to #11893
This commit is contained in:
Adrien Grand 2015-06-29 12:46:00 +02:00
parent 80d0f1e5ea
commit 21ffd931ec
14 changed files with 47 additions and 47 deletions

View File

@ -140,7 +140,7 @@ public class ClusterStatsIndices implements ToXContent, Streamable {
docs = DocsStats.readDocStats(in);
store = StoreStats.readStoreStats(in);
fieldData = FieldDataStats.readFieldDataStats(in);
queryCache = QueryCacheStats.readFilterCacheStats(in);
queryCache = QueryCacheStats.readQueryCacheStats(in);
completion = CompletionStats.readCompletionStats(in);
segments = SegmentsStats.readSegmentsStats(in);
percolate = PercolateStats.readPercolateStats(in);

View File

@ -539,7 +539,7 @@ public class CommonStats implements Streamable, ToXContent {
warmer = WarmerStats.readWarmerStats(in);
}
if (in.readBoolean()) {
queryCache = QueryCacheStats.readFilterCacheStats(in);
queryCache = QueryCacheStats.readQueryCacheStats(in);
}
if (in.readBoolean()) {
fieldData = FieldDataStats.readFieldDataStats(in);

View File

@ -31,10 +31,10 @@ import org.elasticsearch.index.cache.query.index.IndexQueryCache;
*/
public class QueryCacheModule extends AbstractModule {
public static final class FilterCacheSettings {
public static final String FILTER_CACHE_TYPE = "index.queries.cache.type";
public static final class QueryCacheSettings {
public static final String QUERY_CACHE_TYPE = "index.queries.cache.type";
// for test purposes only
public static final String FILTER_CACHE_EVERYTHING = "index.queries.cache.everything";
public static final String QUERY_CACHE_EVERYTHING = "index.queries.cache.everything";
}
private final Settings settings;
@ -46,12 +46,12 @@ public class QueryCacheModule extends AbstractModule {
@Override
protected void configure() {
bind(QueryCache.class)
.to(settings.getAsClass(FilterCacheSettings.FILTER_CACHE_TYPE, IndexQueryCache.class, "org.elasticsearch.index.cache.query.", "FilterCache"))
.to(settings.getAsClass(QueryCacheSettings.QUERY_CACHE_TYPE, IndexQueryCache.class, "org.elasticsearch.index.cache.query.", "QueryCache"))
.in(Scopes.SINGLETON);
// the query cache is a node-level thing, however we want the most popular queries
// to be computed on a per-index basis, that is why we don't use the SINGLETON
// scope below
if (settings.getAsBoolean(FilterCacheSettings.FILTER_CACHE_EVERYTHING, false)) {
if (settings.getAsBoolean(QueryCacheSettings.QUERY_CACHE_EVERYTHING, false)) {
bind(QueryCachingPolicy.class).toInstance(QueryCachingPolicy.ALWAYS_CACHE);
} else {
bind(QueryCachingPolicy.class).toInstance(new UsageTrackingQueryCachingPolicy());

View File

@ -108,7 +108,7 @@ public class QueryCacheStats implements Streamable, ToXContent {
return cacheCount - cacheSize;
}
public static QueryCacheStats readFilterCacheStats(StreamInput in) throws IOException {
public static QueryCacheStats readQueryCacheStats(StreamInput in) throws IOException {
QueryCacheStats stats = new QueryCacheStats();
stats.readFrom(in);
return stats;

View File

@ -36,12 +36,12 @@ import org.elasticsearch.indices.cache.query.IndicesQueryCache;
*/
public class IndexQueryCache extends AbstractIndexComponent implements QueryCache {
final IndicesQueryCache indicesFilterCache;
final IndicesQueryCache indicesQueryCache;
@Inject
public IndexQueryCache(Index index, @IndexSettings Settings indexSettings, IndicesQueryCache indicesFilterCache) {
public IndexQueryCache(Index index, @IndexSettings Settings indexSettings, IndicesQueryCache indicesQueryCache) {
super(index, indexSettings);
this.indicesFilterCache = indicesFilterCache;
this.indicesQueryCache = indicesQueryCache;
}
@Override
@ -52,12 +52,12 @@ public class IndexQueryCache extends AbstractIndexComponent implements QueryCach
@Override
public void clear(String reason) {
logger.debug("full cache clear, reason [{}]", reason);
indicesFilterCache.clearIndex(index.getName());
indicesQueryCache.clearIndex(index.getName());
}
@Override
public Weight doCache(Weight weight, QueryCachingPolicy policy) {
return indicesFilterCache.doCache(weight, policy);
return indicesQueryCache.doCache(weight, policy);
}
}

View File

@ -155,7 +155,7 @@ public class IndexShard extends AbstractIndexShardComponent {
private final EngineConfig engineConfig;
private final TranslogConfig translogConfig;
private final MergePolicyConfig mergePolicyConfig;
private final IndicesQueryCache indicesFilterCache;
private final IndicesQueryCache indicesQueryCache;
private final StoreRecoveryService storeRecoveryService;
private TimeValue refreshInterval;
@ -192,7 +192,7 @@ public class IndexShard extends AbstractIndexShardComponent {
@Inject
public IndexShard(ShardId shardId, IndexSettingsService indexSettingsService, IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache, IndexAliasesService indexAliasesService,
IndicesQueryCache indicesFilterCache, ShardPercolateService shardPercolateService, CodecService codecService,
IndicesQueryCache indicesQueryCache, ShardPercolateService shardPercolateService, CodecService codecService,
ShardTermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService, IndexService indexService,
@Nullable IndicesWarmer warmer, SnapshotDeletionPolicy deletionPolicy, SimilarityService similarityService, EngineFactory factory,
ClusterService clusterService, ShardPath path, BigArrays bigArrays) {
@ -219,7 +219,7 @@ public class IndexShard extends AbstractIndexShardComponent {
this.termVectorsService = termVectorsService.setIndexShard(this);
this.searchService = new ShardSearchStats(indexSettings);
this.shardWarmerService = new ShardIndexWarmerService(shardId, indexSettings);
this.indicesFilterCache = indicesFilterCache;
this.indicesQueryCache = indicesQueryCache;
this.shardQueryCache = new ShardRequestCache(shardId, indexSettings);
this.shardFieldData = new ShardFieldData();
this.percolatorQueriesRegistry = new PercolatorQueriesRegistry(shardId, indexSettings, queryParserService, indexingService, indicesLifecycle, mapperService, indexFieldDataService, shardPercolateService);
@ -616,7 +616,7 @@ public class IndexShard extends AbstractIndexShardComponent {
}
public QueryCacheStats queryCacheStats() {
return indicesFilterCache.getStats(shardId);
return indicesQueryCache.getStats(shardId);
}
public FieldDataStats fieldDataStats(String... fields) {

View File

@ -60,7 +60,7 @@ public final class ShadowIndexShard extends IndexShard {
IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
ThreadPool threadPool, MapperService mapperService,
IndexQueryParserService queryParserService, IndexCache indexCache,
IndexAliasesService indexAliasesService, IndicesQueryCache indicesFilterCache,
IndexAliasesService indexAliasesService, IndicesQueryCache indicesQueryCache,
ShardPercolateService shardPercolateService, CodecService codecService,
ShardTermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
IndexService indexService, @Nullable IndicesWarmer warmer,
@ -69,7 +69,7 @@ public final class ShadowIndexShard extends IndexShard {
ShardPath path, BigArrays bigArrays) throws IOException {
super(shardId, indexSettingsService, indicesLifecycle, store, storeRecoveryService,
threadPool, mapperService, queryParserService, indexCache, indexAliasesService,
indicesFilterCache, shardPercolateService, codecService,
indicesQueryCache, shardPercolateService, codecService,
termVectorsService, indexFieldDataService, indexService,
warmer, deletionPolicy, similarityService,
factory, clusterService, path, bigArrays);

View File

@ -132,12 +132,12 @@ public class NodeIndicesStats implements Streamable, Serializable, ToXContent {
}
@Nullable
public QueryCacheStats getFilterCache() {
public QueryCacheStats getQueryCache() {
return stats.getQueryCache();
}
@Nullable
public RequestCacheStats getQueryCache() {
public RequestCacheStats getRequestCache() {
return stats.getRequestCache();
}

View File

@ -269,11 +269,11 @@ public class RestNodesAction extends AbstractCatAction {
table.addCell(fdStats == null ? null : fdStats.getMemorySize());
table.addCell(fdStats == null ? null : fdStats.getEvictions());
QueryCacheStats fcStats = indicesStats == null ? null : indicesStats.getFilterCache();
QueryCacheStats fcStats = indicesStats == null ? null : indicesStats.getQueryCache();
table.addCell(fcStats == null ? null : fcStats.getMemorySize());
table.addCell(fcStats == null ? null : fcStats.getEvictions());
RequestCacheStats qcStats = indicesStats == null ? null : indicesStats.getQueryCache();
RequestCacheStats qcStats = indicesStats == null ? null : indicesStats.getRequestCache();
table.addCell(qcStats == null ? null : qcStats.getMemorySize());
table.addCell(qcStats == null ? null : qcStats.getEvictions());
table.addCell(qcStats == null ? null : qcStats.getHitCount());

View File

@ -41,7 +41,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.cache.query.QueryCacheModule;
import org.elasticsearch.index.cache.query.QueryCacheStats;
import org.elasticsearch.index.cache.query.QueryCacheModule.FilterCacheSettings;
import org.elasticsearch.index.cache.query.QueryCacheModule.QueryCacheSettings;
import org.elasticsearch.index.cache.query.index.IndexQueryCache;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.shard.MergePolicyConfig;
@ -79,8 +79,8 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
//Filter/Query cache is cleaned periodically, default is 60s, so make sure it runs often. Thread.sleep for 60s is bad
return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal))
.put(IndicesRequestCache.INDICES_CACHE_REQUEST_CLEAN_INTERVAL, "1ms")
.put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true)
.put(QueryCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexQueryCache.class)
.put(QueryCacheSettings.QUERY_CACHE_EVERYTHING, true)
.put(QueryCacheModule.QueryCacheSettings.QUERY_CACHE_TYPE, IndexQueryCache.class)
.build();
}
@ -143,7 +143,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
.execute().actionGet();
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getFilterCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFilterCache().getMemorySizeInBytes(), equalTo(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats("test")
.clear().setFieldData(true).setQueryCache(true)
@ -164,7 +164,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
.execute().actionGet();
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getFilterCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFilterCache().getMemorySizeInBytes(), greaterThan(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), greaterThan(0l));
indicesStats = client().admin().indices().prepareStats("test")
.clear().setFieldData(true).setQueryCache(true)
@ -177,7 +177,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
.execute().actionGet();
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getFilterCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFilterCache().getMemorySizeInBytes(), equalTo(0l));
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
indicesStats = client().admin().indices().prepareStats("test")
.clear().setFieldData(true).setQueryCache(true)
@ -970,7 +970,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
assertEquals(stats1.getTotalCount(), stats2.getTotalCount());
}
private void assertCumulativeFilterCacheStats(IndicesStatsResponse response) {
private void assertCumulativeQueryCacheStats(IndicesStatsResponse response) {
assertAllSuccessful(response);
QueryCacheStats total = response.getTotal().queryCache;
QueryCacheStats indexTotal = new QueryCacheStats();
@ -993,13 +993,13 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
ensureGreen();
IndicesStatsResponse response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertEquals(0, response.getTotal().queryCache.getCacheSize());
SearchResponse r;
assertSearchResponse(r = client().prepareSearch("index").setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.matchQuery("foo", "baz"))).get());
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), equalTo(0L));
assertThat(response.getTotal().queryCache.getEvictions(), equalTo(0L));
assertThat(response.getTotal().queryCache.getMissCount(), greaterThan(0L));
@ -1007,7 +1007,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
assertSearchResponse(client().prepareSearch("index").setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.matchQuery("foo", "baz"))).get());
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getEvictions(), equalTo(0L));
assertThat(response.getTotal().queryCache.getMissCount(), greaterThan(0L));
@ -1017,7 +1017,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
assertTrue(client().prepareDelete("index", "type", "2").get().isFound());
refresh();
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getEvictions(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getCacheSize(), equalTo(0L));
@ -1029,7 +1029,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
assertSearchResponse(client().prepareSearch("index").setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.matchQuery("foo", "baz"))).get());
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getEvictions(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getMissCount(), greaterThan(0L));
@ -1038,7 +1038,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
assertAllSuccessful(client().admin().indices().prepareClearCache("index").setQueryCache(true).get());
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeFilterCacheStats(response);
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getEvictions(), greaterThan(0L));
assertThat(response.getTotal().queryCache.getMissCount(), greaterThan(0L));

View File

@ -31,7 +31,7 @@ import org.elasticsearch.common.lucene.search.function.CombineFunction;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.cache.query.QueryCacheModule;
import org.elasticsearch.index.cache.query.QueryCacheModule.FilterCacheSettings;
import org.elasticsearch.index.cache.query.QueryCacheModule.QueryCacheSettings;
import org.elasticsearch.index.cache.query.index.IndexQueryCache;
import org.elasticsearch.index.mapper.MergeMappingException;
import org.elasticsearch.index.query.HasChildQueryBuilder;
@ -75,8 +75,8 @@ public class ChildQuerySearchTests extends ElasticsearchIntegrationTest {
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal))
// aggressive filter caching so that we can assert on the filter cache size
.put(QueryCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexQueryCache.class)
.put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true)
.put(QueryCacheModule.QueryCacheSettings.QUERY_CACHE_TYPE, IndexQueryCache.class)
.put(QueryCacheSettings.QUERY_CACHE_EVERYTHING, true)
.build();
}

View File

@ -22,7 +22,7 @@ package org.elasticsearch.search.scriptfilter;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.cache.query.QueryCacheModule;
import org.elasticsearch.index.cache.query.QueryCacheModule.FilterCacheSettings;
import org.elasticsearch.index.cache.query.QueryCacheModule.QueryCacheSettings;
import org.elasticsearch.index.cache.query.index.IndexQueryCache;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptService.ScriptType;
@ -51,8 +51,8 @@ public class ScriptQuerySearchTests extends ElasticsearchIntegrationTest {
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal))
// aggressive filter caching so that we can assert on the number of iterations of the script filters
.put(QueryCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexQueryCache.class)
.put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true)
.put(QueryCacheModule.QueryCacheSettings.QUERY_CACHE_TYPE, IndexQueryCache.class)
.put(QueryCacheSettings.QUERY_CACHE_EVERYTHING, true)
.build();
}

View File

@ -142,7 +142,7 @@ public final class ExternalTestCluster extends TestCluster {
// turn increments the breaker, making it non-0
assertThat("Fielddata size must be 0 on node: " + stats.getNode(), stats.getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
assertThat("Filter cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getFilterCache().getMemorySizeInBytes(), equalTo(0l));
assertThat("Query cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
assertThat("FixedBitSet cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getSegments().getBitsetMemoryInBytes(), equalTo(0l));
}
}

View File

@ -73,7 +73,7 @@ import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.cache.query.QueryCacheModule;
import org.elasticsearch.index.cache.query.QueryCacheModule.FilterCacheSettings;
import org.elasticsearch.index.cache.query.QueryCacheModule.QueryCacheSettings;
import org.elasticsearch.index.cache.query.index.IndexQueryCache;
import org.elasticsearch.index.cache.query.none.NoneQueryCache;
import org.elasticsearch.index.engine.CommitStats;
@ -438,11 +438,11 @@ public final class InternalTestCluster extends TestCluster {
}
if (random.nextBoolean()) {
builder.put(QueryCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, random.nextBoolean() ? IndexQueryCache.class : NoneQueryCache.class);
builder.put(QueryCacheModule.QueryCacheSettings.QUERY_CACHE_TYPE, random.nextBoolean() ? IndexQueryCache.class : NoneQueryCache.class);
}
if (random.nextBoolean()) {
builder.put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, random.nextBoolean());
builder.put(QueryCacheSettings.QUERY_CACHE_EVERYTHING, random.nextBoolean());
}
if (random.nextBoolean()) {
@ -1807,7 +1807,7 @@ public final class InternalTestCluster extends TestCluster {
NodeService nodeService = getInstanceFromNode(NodeService.class, nodeAndClient.node);
NodeStats stats = nodeService.stats(CommonStatsFlags.ALL, false, false, false, false, false, false, false, false, false);
assertThat("Fielddata size must be 0 on node: " + stats.getNode(), stats.getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
assertThat("Filter cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getFilterCache().getMemorySizeInBytes(), equalTo(0l));
assertThat("Query cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
assertThat("FixedBitSet cache size must be 0 on node: " + stats.getNode(), stats.getIndices().getSegments().getBitsetMemoryInBytes(), equalTo(0l));
}
}