Skip to content

Commit bccd38a

Browse files
authored
Merge branch 'main' into cps-expression-rewriter
2 parents b57fdaf + daf5ddc commit bccd38a

File tree

15 files changed

+113
-53
lines changed

15 files changed

+113
-53
lines changed

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/TSDBIndexingIT.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -698,19 +698,13 @@ public void testAddDimensionToMapping() throws Exception {
698698
}
699699
""", XContentType.JSON);
700700
ActionFuture<AcknowledgedResponse> putMappingFuture = client().execute(TransportPutMappingAction.TYPE, putMappingRequest);
701-
if (INDEX_DIMENSIONS_TSID_OPTIMIZATION_FEATURE_FLAG) {
702-
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, putMappingFuture::actionGet);
703-
assertThat(
704-
exception.getMessage(),
705-
containsString("Cannot add dynamic templates that define dimension fields on an existing index with index.dimensions")
706-
);
707-
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_DIMENSIONS), containsInAnyOrder("metricset", "k8s.pod.name"));
708-
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_ROUTING_PATH), empty());
709-
} else {
710-
assertAcked(putMappingFuture);
711-
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_ROUTING_PATH), containsInAnyOrder("metricset"));
712-
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_DIMENSIONS), empty());
713-
}
701+
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, putMappingFuture::actionGet);
702+
assertThat(
703+
exception.getMessage(),
704+
containsString("Cannot add dynamic templates that define dimension fields on an existing index with index.dimensions")
705+
);
706+
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_DIMENSIONS), containsInAnyOrder("metricset", "k8s.pod.name"));
707+
assertThat(getSetting(dataStreamName, IndexMetadata.INDEX_ROUTING_PATH), empty());
714708
indexWithPodNames(dataStreamName, Instant.now(), Map.of(), "dog", "cat");
715709
}
716710

muted-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,21 +591,12 @@ tests:
591591
- class: org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT
592592
method: test
593593
issue: https://github.com/elastic/elasticsearch/issues/134407
594-
- class: org.elasticsearch.action.admin.cluster.stats.SearchUsageStatsTests
595-
method: testToXContent
596-
issue: https://github.com/elastic/elasticsearch/issues/135558
597-
- class: org.elasticsearch.search.ccs.SparseVectorQueryBuilderCrossClusterSearchIT
598-
method: testSparseVectorQueryWithCcsMinimizeRoundTripsFalse
599-
issue: https://github.com/elastic/elasticsearch/issues/135559
600594
- class: org.elasticsearch.cluster.routing.allocation.decider.RestoreInProgressAllocationDeciderTests
601595
method: testCanAllocatePrimaryExistingInRestoreInProgress
602596
issue: https://github.com/elastic/elasticsearch/issues/135566
603597
- class: org.elasticsearch.xpack.esql.inference.textembedding.TextEmbeddingOperatorTests
604598
method: testSimpleCircuitBreaking
605599
issue: https://github.com/elastic/elasticsearch/issues/135569
606-
- class: org.elasticsearch.search.ccs.KnnVectorQueryBuilderCrossClusterSearchIT
607-
method: testKnnQueryWithCcsMinimizeRoundTripsFalse
608-
issue: https://github.com/elastic/elasticsearch/issues/135573
609600
- class: org.elasticsearch.multiproject.test.XpackWithMultipleProjectsClientYamlTestSuiteIT
610601
method: test {yaml=esql/60_usage/Basic ESQL usage output (telemetry) snapshot version}
611602
issue: https://github.com/elastic/elasticsearch/issues/135579

server/src/main/java/org/elasticsearch/action/admin/cluster/stats/SearchUsageStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public SearchUsageStats() {
5151
this.sections = new HashMap<>();
5252
this.rescorers = new HashMap<>();
5353
this.retrievers = new HashMap<>();
54-
this.extendedSearchUsageStats = ExtendedSearchUsageStats.EMPTY;
54+
this.extendedSearchUsageStats = new ExtendedSearchUsageStats();
5555
}
5656

5757
/**

server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public abstract class ReplicationRequest<Request extends ReplicationRequest<Requ
3838
implements
3939
IndicesRequest {
4040

41+
// superseded
4142
private static final TransportVersion INDEX_RESHARD_SHARDCOUNT_SUMMARY = TransportVersion.fromName("index_reshard_shardcount_summary");
43+
// bumped to use VInt instead of Int
44+
private static final TransportVersion INDEX_RESHARD_SHARDCOUNT_SMALL = TransportVersion.fromName("index_reshard_shardcount_small");
4245

4346
public static final TimeValue DEFAULT_TIMEOUT = TimeValue.timeValueMinutes(1);
4447

@@ -126,14 +129,16 @@ public ReplicationRequest(@Nullable ShardId shardId, int reshardSplitShardCountS
126129
index = in.readString();
127130
}
128131
routedBasedOnClusterVersion = in.readVLong();
129-
if (in.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SUMMARY)) {
130-
if (thinRead) {
131-
this.reshardSplitShardCountSummary = reshardSplitShardCountSummary;
132-
} else {
132+
if (thinRead) {
133+
this.reshardSplitShardCountSummary = reshardSplitShardCountSummary;
134+
} else {
135+
if (in.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SMALL)) {
136+
this.reshardSplitShardCountSummary = in.readVInt();
137+
} else if (in.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SUMMARY)) {
133138
this.reshardSplitShardCountSummary = in.readInt();
139+
} else {
140+
this.reshardSplitShardCountSummary = 0;
134141
}
135-
} else {
136-
this.reshardSplitShardCountSummary = 0;
137142
}
138143
}
139144

@@ -262,7 +267,9 @@ public void writeTo(StreamOutput out) throws IOException {
262267
out.writeTimeValue(timeout);
263268
out.writeString(index);
264269
out.writeVLong(routedBasedOnClusterVersion);
265-
if (out.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SUMMARY)) {
270+
if (out.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SMALL)) {
271+
out.writeVInt(reshardSplitShardCountSummary);
272+
} else if (out.getTransportVersion().supports(INDEX_RESHARD_SHARDCOUNT_SUMMARY)) {
266273
out.writeInt(reshardSplitShardCountSummary);
267274
}
268275
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9181000
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
elastic_reranker_chunking_configuration,9180000
1+
index_reshard_shardcount_small,9181000

test/framework/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@
1010
apply plugin: 'elasticsearch.build'
1111
apply plugin: 'elasticsearch.publish'
1212

13-
configurations {
14-
// we do not want to expose a version conflict in transitive dependencies by
15-
// bringing in different versions of hamcrest and hamcrest-core.
16-
// Therefore we exclude transitive deps on hamcrest-core here as we have a direct
17-
// dependency on a newer version.
18-
runtimeElements {
19-
exclude group: 'org.hamcrest', module: 'hamcrest-core'
20-
}
21-
}
2213
dependencies {
2314
api project(":client:rest")
2415
api project(':modules:transport-netty4')
2516
api project(':libs:ssl-config')
2617
api project(":server")
2718
api project(":libs:cli")
2819
api project(":libs:entitlement:bridge")
29-
api "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
30-
api("junit:junit:${versions.junit}") {
31-
// exclude group: 'org.hamcrest'
20+
api ("com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}") {
21+
exclude group: "junit", module: "junit"
3222
}
23+
24+
// we do not want to expose a version conflict in transitive dependencies by
25+
// bringing in different versions of dependencies.
26+
// Therefore we exclude mismatches in our transitive dependencies explicitly.
27+
// This also avoids jarHell issues with different hamcrest related dependencies
28+
// like hamcrest and hamcrest-core
3329
api "org.hamcrest:hamcrest:${versions.hamcrest}"
30+
api("junit:junit:${versions.junit}") {
31+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
32+
}
3433
api("org.apache.lucene:lucene-test-framework:${versions.lucene}") {
35-
// exclude group: 'org.hamcrest'
34+
exclude group: "junit", module: "junit"
35+
exclude group: 'com.carrotsearch.randomizedtesting', module: 'randomizedtesting-runner'
3636
}
3737
api "org.apache.lucene:lucene-codecs:${versions.lucene}"
3838
api "commons-logging:commons-logging:${versions.commonslogging}"

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCache.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
import java.io.Closeable;
4040
import java.io.IOException;
41-
import java.util.Collections;
4241
import java.util.LinkedHashMap;
4342
import java.util.List;
4443
import java.util.Map;
@@ -316,7 +315,7 @@ public Map<String, Object> usageStats() {
316315
stats.put("evictions", cacheStats.getEvictions());
317316
stats.put("hits_time_in_millis", TimeValue.nsecToMSec(hitsTimeInNanos.sum()));
318317
stats.put("misses_time_in_millis", TimeValue.nsecToMSec(missesTimeInNanos.sum()));
319-
return Collections.unmodifiableMap(stats);
318+
return stats;
320319
}
321320

322321
private static final class BitsetCacheKey {

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/stats/GetSecurityStatsNodeResponseTests.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
1111
import org.elasticsearch.common.io.stream.Writeable;
12+
import org.elasticsearch.common.util.Maps;
1213
import org.elasticsearch.test.AbstractWireSerializingTestCase;
1314

1415
import java.io.IOException;
1516
import java.util.Map;
1617
import java.util.Objects;
1718

19+
import static org.hamcrest.Matchers.equalTo;
20+
1821
public class GetSecurityStatsNodeResponseTests extends AbstractWireSerializingTestCase<GetSecurityStatsNodeResponse> {
1922

2023
@Override
@@ -46,4 +49,20 @@ protected GetSecurityStatsNodeResponse mutateInstance(GetSecurityStatsNodeRespon
4649
default -> throw new IllegalStateException("Unexpected value");
4750
};
4851
}
52+
53+
public void testRolesStatsInOrderSerialization() throws IOException {
54+
final Map<String, Object> rolesStats = Maps.newLinkedHashMapWithExpectedSize(3);
55+
rolesStats.put("one", "value");
56+
rolesStats.put("two", "value");
57+
rolesStats.put("three", "value");
58+
final GetSecurityStatsNodeResponse in = new GetSecurityStatsNodeResponse(
59+
DiscoveryNodeUtils.create(randomAlphaOfLength(10)),
60+
rolesStats
61+
);
62+
63+
final GetSecurityStatsNodeResponse out = copyInstance(in);
64+
assertThat(in, equalTo(out));
65+
66+
assertThat(out.getRolesStoreStats().keySet().toArray(new String[0]), equalTo(new String[] { "one", "two", "three" }));
67+
}
4968
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
import static org.hamcrest.Matchers.equalTo;
6767
import static org.hamcrest.Matchers.greaterThan;
68+
import static org.hamcrest.Matchers.instanceOf;
6869
import static org.hamcrest.Matchers.is;
6970
import static org.hamcrest.Matchers.lessThan;
7071
import static org.hamcrest.Matchers.not;
@@ -529,6 +530,11 @@ public void testHitsMissesAndEvictionsStats() throws Exception {
529530
assertThat(cache.usageStats(), equalTo(finalStats));
530531
}
531532

533+
public void testUsageStatsAreOrdered() {
534+
final Map<String, Object> stats = newCache(Settings.EMPTY).usageStats();
535+
assertThat("needs to be LinkedHashMap for order in transport", stats, instanceOf(LinkedHashMap.class));
536+
}
537+
532538
private void runTestOnIndex(CheckedBiConsumer<SearchExecutionContext, LeafReaderContext, Exception> body) throws Exception {
533539
runTestOnIndices(1, ctx -> {
534540
final TestIndexContext indexContext = ctx.get(0);

0 commit comments

Comments
 (0)