Skip to content

Commit

Permalink
Fix missing renamings.
Browse files Browse the repository at this point in the history
Relates to elastic#11893
  • Loading branch information
jpountz authored and szroland committed Jun 30, 2015
1 parent b0fadb6 commit 8d45799
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 47 deletions.
Expand Up @@ -140,7 +140,7 @@ public void readFrom(StreamInput in) throws IOException {
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);
Expand Down
Expand Up @@ -539,7 +539,7 @@ public void readFrom(StreamInput in) throws IOException {
warmer = WarmerStats.readWarmerStats(in);
}
if (in.readBoolean()) {
queryCache = QueryCacheStats.readFilterCacheStats(in);
queryCache = QueryCacheStats.readQueryCacheStats(in);
}
if (in.readBoolean()) {
fieldData = FieldDataStats.readFieldDataStats(in);
Expand Down
Expand Up @@ -31,10 +31,10 @@
*/
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;
Expand All @@ -46,12 +46,12 @@ public QueryCacheModule(Settings settings) {
@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());
Expand Down
Expand Up @@ -108,7 +108,7 @@ public long getEvictions() {
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;
Expand Down
Expand Up @@ -36,12 +36,12 @@
*/
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
Expand All @@ -52,12 +52,12 @@ public void close() throws ElasticsearchException {
@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);
}

}
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -219,7 +219,7 @@ public IndexShard(ShardId shardId, IndexSettingsService indexSettingsService, In
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);
Expand Down Expand Up @@ -616,7 +616,7 @@ public WarmerStats warmerStats() {
}

public QueryCacheStats queryCacheStats() {
return indicesFilterCache.getStats(shardId);
return indicesQueryCache.getStats(shardId);
}

public FieldDataStats fieldDataStats(String... fields) {
Expand Down
Expand Up @@ -60,7 +60,7 @@ public ShadowIndexShard(ShardId shardId, IndexSettingsService indexSettingsServi
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,
Expand All @@ -69,7 +69,7 @@ public ShadowIndexShard(ShardId shardId, IndexSettingsService indexSettingsServi
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);
Expand Down
Expand Up @@ -132,12 +132,12 @@ public FieldDataStats getFieldData() {
}

@Nullable
public QueryCacheStats getFilterCache() {
public QueryCacheStats getQueryCache() {
return stats.getQueryCache();
}

@Nullable
public RequestCacheStats getQueryCache() {
public RequestCacheStats getRequestCache() {
return stats.getRequestCache();
}

Expand Down
Expand Up @@ -269,11 +269,11 @@ private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoR
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());
Expand Down
Expand Up @@ -41,7 +41,7 @@
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;
Expand Down Expand Up @@ -79,8 +79,8 @@ protected Settings nodeSettings(int nodeOrdinal) {
//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();
}

Expand Down Expand Up @@ -143,7 +143,7 @@ public void testClearAllCaches() throws Exception {
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)
Expand All @@ -164,7 +164,7 @@ public void testClearAllCaches() throws Exception {
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)
Expand All @@ -177,7 +177,7 @@ public void testClearAllCaches() throws Exception {
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)
Expand Down Expand Up @@ -970,7 +970,7 @@ private void assertEquals(QueryCacheStats stats1, QueryCacheStats stats2) {
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();
Expand All @@ -993,21 +993,21 @@ public void testFilterCacheStats() throws Exception {
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));
assertThat(response.getTotal().queryCache.getCacheSize(), greaterThan(0L));

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));
Expand All @@ -1017,7 +1017,7 @@ public void testFilterCacheStats() throws Exception {
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));
Expand All @@ -1029,7 +1029,7 @@ public void testFilterCacheStats() throws Exception {
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));
Expand All @@ -1038,7 +1038,7 @@ public void testFilterCacheStats() throws Exception {

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));
Expand Down
Expand Up @@ -31,7 +31,7 @@
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;
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 8d45799

Please sign in to comment.