Skip to content

Commit 57cc13d

Browse files
committed
Merge branch 'main' into cache-interface
# Conflicts: # server/src/main/java/org/elasticsearch/common/cache/Cache.java
2 parents 73824cc + ea97e17 commit 57cc13d

File tree

8 files changed

+27
-12
lines changed

8 files changed

+27
-12
lines changed

modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public int count() {
120120
* @return Current stats about this cache
121121
*/
122122
public CacheStats getCacheStats() {
123-
Cache.CacheStats stats = cache.stats();
123+
Cache.Stats stats = cache.stats();
124124
return new CacheStats(
125125
cache.count(),
126126
stats.getHits(),

server/src/internalClusterTest/java/org/elasticsearch/index/shard/IndexShardIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,16 @@ public void testShardWriteLoadsArePresent() {
396396
// Verify that each shard has write-load reported.
397397
final ClusterState state = getInstanceFromNode(ClusterService.class).state();
398398
assertEquals(state.projectState(ProjectId.DEFAULT).metadata().getTotalNumberOfShards(), shardWriteLoads.size());
399-
double maximumLoadRecorded = 0;
400399
for (IndexMetadata indexMetadata : state.projectState(ProjectId.DEFAULT).metadata()) {
400+
double maximumLoadRecorded = 0;
401401
for (int i = 0; i < indexMetadata.getNumberOfShards(); i++) {
402402
final ShardId shardId = new ShardId(indexMetadata.getIndex(), i);
403403
assertTrue(shardWriteLoads.containsKey(shardId));
404404
maximumLoadRecorded = Math.max(shardWriteLoads.get(shardId), maximumLoadRecorded);
405405
}
406+
// Each index should have seen some write-load
407+
assertThat(maximumLoadRecorded, greaterThan(0.0));
406408
}
407-
// And that at least one is greater than zero
408-
assertThat(maximumLoadRecorded, greaterThan(0.0));
409409
} finally {
410410
updateClusterSettings(
411411
Settings.builder().putNull(WriteLoadConstraintSettings.WRITE_LOAD_DECIDER_ENABLED_SETTING.getKey()).build()

server/src/main/java/org/elasticsearch/common/cache/Cache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ default void refresh() {}
141141
*
142142
* @return the current cache statistics
143143
*/
144-
CacheStats stats();
144+
Stats stats();
145145

146146
/**
147147
* Performs an action for each cache entry in the cache. While iterating over the cache entries this method might use locks. As such,
@@ -157,7 +157,7 @@ default void refresh() {}
157157
* @param misses number of times no cached value could be found
158158
* @param evictions number of entries that have been evicted
159159
*/
160-
record CacheStats(long hits, long misses, long evictions) {
160+
record Stats(long hits, long misses, long evictions) {
161161

162162
public long getHits() {
163163
return hits;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/FieldPermissionsCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public FieldPermissionsCache(Settings settings) {
4949
.build();
5050
}
5151

52-
public Cache.CacheStats getCacheStats() {
52+
public Cache.Stats getCacheStats() {
5353
return cache.stats();
5454
}
5555

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
578578
FieldPermissionsCache fieldPermissionsCache = new FieldPermissionsCache(Settings.EMPTY);
579579
RoleDescriptor.setFieldPermissionsCache(fieldPermissionsCache);
580580

581-
final Cache.CacheStats beforeStats = fieldPermissionsCache.getCacheStats();
581+
final Cache.Stats beforeStats = fieldPermissionsCache.getCacheStats();
582582

583583
final String json = """
584584
{
@@ -604,7 +604,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
604604
RoleDescriptor.parserBuilder().build().parse("test", new BytesArray(json), XContentType.JSON);
605605

606606
final int numberOfFieldSecurityBlocks = 2;
607-
final Cache.CacheStats betweenStats = fieldPermissionsCache.getCacheStats();
607+
final Cache.Stats betweenStats = fieldPermissionsCache.getCacheStats();
608608
assertThat(betweenStats.getMisses(), equalTo(beforeStats.getMisses() + numberOfFieldSecurityBlocks));
609609
assertThat(betweenStats.getHits(), equalTo(beforeStats.getHits()));
610610

@@ -613,7 +613,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
613613
RoleDescriptor.parserBuilder().build().parse("test", new BytesArray(json), XContentType.JSON);
614614
}
615615

616-
final Cache.CacheStats afterStats = fieldPermissionsCache.getCacheStats();
616+
final Cache.Stats afterStats = fieldPermissionsCache.getCacheStats();
617617
assertThat(afterStats.getMisses(), equalTo(betweenStats.getMisses()));
618618
assertThat(afterStats.getHits(), equalTo(beforeStats.getHits() + numberOfFieldSecurityBlocks * iterations));
619619
}

x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void put(CacheKey cacheKey, CacheValue cacheValue) {
137137
}
138138

139139
public EnrichStatsAction.Response.CacheStats getStats(String localNodeId) {
140-
Cache.CacheStats cacheStats = cache.stats();
140+
Cache.Stats cacheStats = cache.stats();
141141
return new EnrichStatsAction.Response.CacheStats(
142142
localNodeId,
143143
cache.count(),

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/UnresolvedAttribute.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@
1919
import java.util.List;
2020
import java.util.Objects;
2121

22-
// unfortunately we can't use UnresolvedNamedExpression
22+
/**
23+
* An unresolved attribute. We build these while walking the syntax
24+
* tree and then resolve them into other {@link Attribute} subclasses during
25+
* analysis.
26+
* <p>
27+
* For example, if they reference the data directly from lucene they'll be
28+
* {@link FieldAttribute}s. If they reference the results of another calculation
29+
* they will be {@link ReferenceAttribute}s.
30+
* </p>
31+
*/
2332
public class UnresolvedAttribute extends Attribute implements Unresolvable {
2433
private final boolean customMessage;
2534
private final String unresolvedMsg;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/UnresolvedFunction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.elasticsearch.xpack.esql.expression.function;
88

99
import org.elasticsearch.common.io.stream.StreamOutput;
10+
import org.elasticsearch.xpack.esql.analysis.Analyzer;
1011
import org.elasticsearch.xpack.esql.core.capabilities.Unresolvable;
1112
import org.elasticsearch.xpack.esql.core.capabilities.UnresolvedException;
1213
import org.elasticsearch.xpack.esql.core.expression.Expression;
@@ -24,6 +25,11 @@
2425
import java.util.Objects;
2526
import java.util.Set;
2627

28+
/**
29+
* An unresolved function call. We build these while walking the syntax
30+
* tree and then resolve them into other {@link Function} subclasses during
31+
* {@link Analyzer analysis}.
32+
*/
2733
public class UnresolvedFunction extends Function implements Unresolvable {
2834

2935
private final String name;

0 commit comments

Comments
 (0)