Skip to content

Commit 38f5cc2

Browse files
committed
Rename caches.
In order to be more consistent with what they do, the query cache has been renamed to request cache and the filter cache has been renamed to query cache. A known issue is that package/logger names do no longer match settings names, please speak up if you think this is an issue. Here are the settings for which I kept backward compatibility. Note that they are a bit different from what was discussed on #11569 but putting `cache` before the name of what is cached has the benefit of making these settings consistent with the fielddata cache whose size is configured by `indices.fielddata.cache.size`: * index.cache.query.enable -> index.requests.cache.enable * indices.cache.query.size -> indices.requests.cache.size * indices.cache.filter.size -> indices.queries.cache.size Close #11569
1 parent f5f7325 commit 38f5cc2

File tree

81 files changed

+1390
-1341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1390
-1341
lines changed

core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.elasticsearch.common.xcontent.ToXContent;
3030
import org.elasticsearch.common.xcontent.XContentBuilder;
3131
import org.elasticsearch.common.xcontent.XContentBuilderString;
32-
import org.elasticsearch.index.cache.filter.FilterCacheStats;
32+
import org.elasticsearch.index.cache.query.QueryCacheStats;
3333
import org.elasticsearch.index.engine.SegmentsStats;
3434
import org.elasticsearch.index.fielddata.FieldDataStats;
3535
import org.elasticsearch.index.percolator.stats.PercolateStats;
@@ -46,7 +46,7 @@ public class ClusterStatsIndices implements ToXContent, Streamable {
4646
private DocsStats docs;
4747
private StoreStats store;
4848
private FieldDataStats fieldData;
49-
private FilterCacheStats filterCache;
49+
private QueryCacheStats queryCache;
5050
private CompletionStats completion;
5151
private SegmentsStats segments;
5252
private PercolateStats percolate;
@@ -60,7 +60,7 @@ public ClusterStatsIndices(ClusterStatsNodeResponse[] nodeResponses) {
6060
this.docs = new DocsStats();
6161
this.store = new StoreStats();
6262
this.fieldData = new FieldDataStats();
63-
this.filterCache = new FilterCacheStats();
63+
this.queryCache = new QueryCacheStats();
6464
this.completion = new CompletionStats();
6565
this.segments = new SegmentsStats();
6666
this.percolate = new PercolateStats();
@@ -83,7 +83,7 @@ public ClusterStatsIndices(ClusterStatsNodeResponse[] nodeResponses) {
8383
}
8484
store.add(shardCommonStats.store);
8585
fieldData.add(shardCommonStats.fieldData);
86-
filterCache.add(shardCommonStats.filterCache);
86+
queryCache.add(shardCommonStats.queryCache);
8787
completion.add(shardCommonStats.completion);
8888
segments.add(shardCommonStats.segments);
8989
percolate.add(shardCommonStats.percolate);
@@ -117,8 +117,8 @@ public FieldDataStats getFieldData() {
117117
return fieldData;
118118
}
119119

120-
public FilterCacheStats getFilterCache() {
121-
return filterCache;
120+
public QueryCacheStats getQueryCache() {
121+
return queryCache;
122122
}
123123

124124
public CompletionStats getCompletion() {
@@ -140,7 +140,7 @@ public void readFrom(StreamInput in) throws IOException {
140140
docs = DocsStats.readDocStats(in);
141141
store = StoreStats.readStoreStats(in);
142142
fieldData = FieldDataStats.readFieldDataStats(in);
143-
filterCache = FilterCacheStats.readFilterCacheStats(in);
143+
queryCache = QueryCacheStats.readFilterCacheStats(in);
144144
completion = CompletionStats.readCompletionStats(in);
145145
segments = SegmentsStats.readSegmentsStats(in);
146146
percolate = PercolateStats.readPercolateStats(in);
@@ -153,7 +153,7 @@ public void writeTo(StreamOutput out) throws IOException {
153153
docs.writeTo(out);
154154
store.writeTo(out);
155155
fieldData.writeTo(out);
156-
filterCache.writeTo(out);
156+
queryCache.writeTo(out);
157157
completion.writeTo(out);
158158
segments.writeTo(out);
159159
percolate.writeTo(out);
@@ -176,7 +176,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
176176
docs.toXContent(builder, params);
177177
store.toXContent(builder, params);
178178
fieldData.toXContent(builder, params);
179-
filterCache.toXContent(builder, params);
179+
queryCache.toXContent(builder, params);
180180
completion.toXContent(builder, params);
181181
segments.toXContent(builder, params);
182182
percolate.toXContent(builder, params);

core/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class TransportClusterStatsAction extends TransportNodesAction<ClusterSta
5555
TransportClusterStatsAction.ClusterStatsNodeRequest, ClusterStatsNodeResponse> {
5656

5757
private static final CommonStatsFlags SHARD_STATS_FLAGS = new CommonStatsFlags(CommonStatsFlags.Flag.Docs, CommonStatsFlags.Flag.Store,
58-
CommonStatsFlags.Flag.FieldData, CommonStatsFlags.Flag.FilterCache, CommonStatsFlags.Flag.Completion, CommonStatsFlags.Flag.Segments,
58+
CommonStatsFlags.Flag.FieldData, CommonStatsFlags.Flag.QueryCache, CommonStatsFlags.Flag.Completion, CommonStatsFlags.Flag.Segments,
5959
CommonStatsFlags.Flag.Percolate);
6060

6161
private final NodeService nodeService;

core/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
*/
3131
public class ClearIndicesCacheRequest extends BroadcastRequest<ClearIndicesCacheRequest> {
3232

33-
private boolean filterCache = false;
33+
private boolean queryCache = false;
3434
private boolean fieldDataCache = false;
3535
private boolean recycler = false;
36-
private boolean queryCache = false;
36+
private boolean requestCache = false;
3737
private String[] fields = null;
3838

3939

@@ -44,21 +44,21 @@ public ClearIndicesCacheRequest(String... indices) {
4444
super(indices);
4545
}
4646

47-
public boolean filterCache() {
48-
return filterCache;
47+
public boolean queryCache() {
48+
return queryCache;
4949
}
5050

51-
public ClearIndicesCacheRequest filterCache(boolean filterCache) {
52-
this.filterCache = filterCache;
51+
public ClearIndicesCacheRequest queryCache(boolean queryCache) {
52+
this.queryCache = queryCache;
5353
return this;
5454
}
5555

56-
public boolean queryCache() {
57-
return this.queryCache;
56+
public boolean requestCache() {
57+
return this.requestCache;
5858
}
5959

60-
public ClearIndicesCacheRequest queryCache(boolean queryCache) {
61-
this.queryCache = queryCache;
60+
public ClearIndicesCacheRequest requestCache(boolean requestCache) {
61+
this.requestCache = requestCache;
6262
return this;
6363
}
6464

@@ -92,20 +92,20 @@ public boolean recycler() {
9292
@Override
9393
public void readFrom(StreamInput in) throws IOException {
9494
super.readFrom(in);
95-
filterCache = in.readBoolean();
95+
queryCache = in.readBoolean();
9696
fieldDataCache = in.readBoolean();
9797
recycler = in.readBoolean();
9898
fields = in.readStringArray();
99-
queryCache = in.readBoolean();
99+
requestCache = in.readBoolean();
100100
}
101101

102102
@Override
103103
public void writeTo(StreamOutput out) throws IOException {
104104
super.writeTo(out);
105-
out.writeBoolean(filterCache);
105+
out.writeBoolean(queryCache);
106106
out.writeBoolean(fieldDataCache);
107107
out.writeBoolean(recycler);
108108
out.writeStringArrayNullable(fields);
109-
out.writeBoolean(queryCache);
109+
out.writeBoolean(requestCache);
110110
}
111111
}

core/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequestBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public ClearIndicesCacheRequestBuilder(ElasticsearchClient client, ClearIndicesC
3131
super(client, action, new ClearIndicesCacheRequest());
3232
}
3333

34-
public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) {
35-
request.filterCache(filterCache);
34+
public ClearIndicesCacheRequestBuilder setQueryCache(boolean queryCache) {
35+
request.queryCache(queryCache);
3636
return this;
3737
}
3838

39-
public ClearIndicesCacheRequestBuilder setQueryCache(boolean queryCache) {
40-
request.queryCache(queryCache);
39+
public ClearIndicesCacheRequestBuilder setRequestCache(boolean requestCache) {
40+
request.requestCache(requestCache);
4141
return this;
4242
}
4343

core/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheRequest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
*/
3232
class ShardClearIndicesCacheRequest extends BroadcastShardRequest {
3333

34-
private boolean filterCache = false;
34+
private boolean queryCache = false;
3535
private boolean fieldDataCache = false;
3636
private boolean recycler;
37-
private boolean queryCache = false;
37+
private boolean requestCache = false;
3838

3939
private String[] fields = null;
4040

@@ -43,21 +43,21 @@ class ShardClearIndicesCacheRequest extends BroadcastShardRequest {
4343

4444
ShardClearIndicesCacheRequest(ShardId shardId, ClearIndicesCacheRequest request) {
4545
super(shardId, request);
46-
filterCache = request.filterCache();
46+
queryCache = request.queryCache();
4747
fieldDataCache = request.fieldDataCache();
4848
fields = request.fields();
4949
recycler = request.recycler();
50-
queryCache = request.queryCache();
51-
}
52-
53-
public boolean filterCache() {
54-
return filterCache;
50+
requestCache = request.requestCache();
5551
}
5652

5753
public boolean queryCache() {
5854
return queryCache;
5955
}
6056

57+
public boolean requestCache() {
58+
return requestCache;
59+
}
60+
6161
public boolean fieldDataCache() {
6262
return this.fieldDataCache;
6363
}
@@ -73,20 +73,20 @@ public String[] fields() {
7373
@Override
7474
public void readFrom(StreamInput in) throws IOException {
7575
super.readFrom(in);
76-
filterCache = in.readBoolean();
76+
queryCache = in.readBoolean();
7777
fieldDataCache = in.readBoolean();
7878
recycler = in.readBoolean();
7979
fields = in.readStringArray();
80-
queryCache = in.readBoolean();
80+
requestCache = in.readBoolean();
8181
}
8282

8383
@Override
8484
public void writeTo(StreamOutput out) throws IOException {
8585
super.writeTo(out);
86-
out.writeBoolean(filterCache);
86+
out.writeBoolean(queryCache);
8787
out.writeBoolean(fieldDataCache);
8888
out.writeBoolean(recycler);
8989
out.writeStringArrayNullable(fields);
90-
out.writeBoolean(queryCache);
90+
out.writeBoolean(requestCache);
9191
}
9292
}

core/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/TransportClearIndicesCacheAction.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.elasticsearch.index.IndexService;
3636
import org.elasticsearch.index.shard.IndexShard;
3737
import org.elasticsearch.indices.IndicesService;
38-
import org.elasticsearch.indices.cache.query.IndicesQueryCache;
38+
import org.elasticsearch.indices.cache.request.IndicesRequestCache;
3939
import org.elasticsearch.threadpool.ThreadPool;
4040
import org.elasticsearch.transport.TransportService;
4141

@@ -50,16 +50,16 @@
5050
public class TransportClearIndicesCacheAction extends TransportBroadcastAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ShardClearIndicesCacheRequest, ShardClearIndicesCacheResponse> {
5151

5252
private final IndicesService indicesService;
53-
private final IndicesQueryCache indicesQueryCache;
53+
private final IndicesRequestCache indicesRequestCache;
5454

5555
@Inject
5656
public TransportClearIndicesCacheAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
5757
TransportService transportService, IndicesService indicesService,
58-
IndicesQueryCache indicesQueryCache, ActionFilters actionFilters) {
58+
IndicesRequestCache indicesQueryCache, ActionFilters actionFilters) {
5959
super(settings, ClearIndicesCacheAction.NAME, threadPool, clusterService, transportService, actionFilters,
6060
ClearIndicesCacheRequest.class, ShardClearIndicesCacheRequest.class, ThreadPool.Names.MANAGEMENT);
6161
this.indicesService = indicesService;
62-
this.indicesQueryCache = indicesQueryCache;
62+
this.indicesRequestCache = indicesQueryCache;
6363
}
6464

6565
@Override
@@ -100,9 +100,9 @@ protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRe
100100
if (service != null) {
101101
IndexShard shard = service.shard(request.shardId().id());
102102
boolean clearedAtLeastOne = false;
103-
if (request.filterCache()) {
103+
if (request.queryCache()) {
104104
clearedAtLeastOne = true;
105-
service.cache().filter().clear("api");
105+
service.cache().query().clear("api");
106106
}
107107
if (request.fieldDataCache()) {
108108
clearedAtLeastOne = true;
@@ -114,9 +114,9 @@ protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRe
114114
}
115115
}
116116
}
117-
if (request.queryCache()) {
117+
if (request.requestCache()) {
118118
clearedAtLeastOne = true;
119-
indicesQueryCache.clear(shard);
119+
indicesRequestCache.clear(shard);
120120
}
121121
if (request.recycler()) {
122122
logger.debug("Clear CacheRecycler on index [{}]", service.index());
@@ -132,7 +132,7 @@ protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRe
132132
} else {
133133
service.cache().clear("api");
134134
service.fieldData().clear();
135-
indicesQueryCache.clear(shard);
135+
indicesRequestCache.clear(shard);
136136
}
137137
}
138138
}

core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void writeTo(StreamOutput out) throws IOException {
170170
for (IndexWarmersMetaData.Entry warmerEntry : indexEntry.value) {
171171
out.writeString(warmerEntry.name());
172172
out.writeStringArray(warmerEntry.types());
173-
out.writeOptionalBoolean(warmerEntry.queryCache());
173+
out.writeOptionalBoolean(warmerEntry.requestCache());
174174
out.writeBytesReference(warmerEntry.source());
175175
}
176176
}

0 commit comments

Comments
 (0)