Skip to content

Commit f4f5073

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents 9123cfb + bcd6c1d commit f4f5073

File tree

18 files changed

+162
-260
lines changed

18 files changed

+162
-260
lines changed

docs/changelog/116346.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 116346
2+
summary: "[ESQL] Fix Binary Comparisons on Date Nanos"
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/reference/connector/docs/_connectors-create-native.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PUT _connector/my-{service-name-stub}-connector
2222
"index_name": "my-elasticsearch-index",
2323
"name": "Content synced from {service-name}",
2424
"service_type": "{service-name-stub}",
25-
"is_native": "true"
25+
"is_native": true
2626
}
2727
----
2828
// TEST[skip:can't test in isolation]

docs/reference/search/retriever.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,8 @@ It then re-ranks the results based on semantic similarity to the text in the `in
554554
[[rule-retriever]]
555555
==== Query Rules Retriever
556556

557-
The `rule` retriever enables fine-grained control over search results by applying contextual <<query-rules>> to pin or exclude documents for specific queries.
558-
This retriever has similar functionality to the <<query-dsl-rule-query>>, but works out of the box with other retrievers.
557+
The `rule` retriever enables fine-grained control over search results by applying contextual <<query-rules,query rules>> to pin or exclude documents for specific queries.
558+
This retriever has similar functionality to the <<query-dsl-rule-query, rule query>>, but works out of the box with other retrievers.
559559

560560
===== Prerequisites
561561

muted-tests.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,12 @@ tests:
237237
- class: org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT
238238
method: testSearchWithRandomDisconnects
239239
issue: https://github.com/elastic/elasticsearch/issues/116175
240-
- class: org.elasticsearch.indexing.IndexActionIT
241-
method: testAutoGenerateIdNoDuplicates
242-
issue: https://github.com/elastic/elasticsearch/issues/115716
243240
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
244241
method: test {p0=ml/start_stop_datafeed/Test start datafeed given index pattern with no matching indices}
245242
issue: https://github.com/elastic/elasticsearch/issues/116220
246243
- class: org.elasticsearch.search.basic.SearchWhileRelocatingIT
247244
method: testSearchAndRelocateConcurrentlyRandomReplicas
248245
issue: https://github.com/elastic/elasticsearch/issues/116145
249-
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
250-
method: testProcessFileChanges
251-
issue: https://github.com/elastic/elasticsearch/issues/115280
252246
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
253247
method: test {p0=ml/filter_crud/Test update filter}
254248
issue: https://github.com/elastic/elasticsearch/issues/116271
@@ -261,18 +255,6 @@ tests:
261255
- class: org.elasticsearch.xpack.security.operator.OperatorPrivilegesIT
262256
method: testEveryActionIsEitherOperatorOnlyOrNonOperator
263257
issue: https://github.com/elastic/elasticsearch/issues/102992
264-
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
265-
issue: https://github.com/elastic/elasticsearch/issues/116291
266-
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
267-
issue: https://github.com/elastic/elasticsearch/issues/114723
268-
- class: org.elasticsearch.xpack.search.AsyncSearchSecurityIT
269-
issue: https://github.com/elastic/elasticsearch/issues/116293
270-
- class: org.elasticsearch.xpack.downsample.DownsampleRestIT
271-
issue: https://github.com/elastic/elasticsearch/issues/116326
272-
- class: org.elasticsearch.xpack.downsample.DownsampleWithBasicRestIT
273-
issue: https://github.com/elastic/elasticsearch/issues/116327
274-
- class: org.elasticsearch.validation.DotPrefixClientYamlTestSuiteIT
275-
issue: https://github.com/elastic/elasticsearch/issues/116328
276258
- class: org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests
277259
method: testBottomFieldSort
278260
issue: https://github.com/elastic/elasticsearch/issues/116249
@@ -288,6 +270,9 @@ tests:
288270
- class: org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsIntegTests
289271
method: testCreateAndRestoreSearchableSnapshot
290272
issue: https://github.com/elastic/elasticsearch/issues/116377
273+
- class: org.elasticsearch.threadpool.SimpleThreadPoolIT
274+
method: testThreadPoolMetrics
275+
issue: https://github.com/elastic/elasticsearch/issues/108320
291276

292277
# Examples:
293278
#

server/src/main/java/org/elasticsearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
import java.util.List;
4949
import java.util.Map;
5050
import java.util.concurrent.ConcurrentHashMap;
51+
import java.util.concurrent.ConcurrentLinkedQueue;
5152
import java.util.concurrent.Executor;
52-
import java.util.concurrent.LinkedTransferQueue;
5353
import java.util.concurrent.Semaphore;
5454
import java.util.concurrent.atomic.AtomicBoolean;
5555
import java.util.concurrent.atomic.AtomicInteger;
@@ -751,7 +751,7 @@ protected final ShardSearchRequest buildShardSearchRequest(SearchShardIterator s
751751

752752
private static final class PendingExecutions {
753753
private final Semaphore semaphore;
754-
private final LinkedTransferQueue<Consumer<Releasable>> queue = new LinkedTransferQueue<>();
754+
private final ConcurrentLinkedQueue<Consumer<Releasable>> queue = new ConcurrentLinkedQueue<>();
755755

756756
PendingExecutions(int permits) {
757757
assert permits > 0 : "not enough permits: " + permits;
@@ -770,11 +770,10 @@ void submit(Consumer<Releasable> task) {
770770
}
771771
}
772772
}
773-
774773
}
775774

776775
private void executeAndRelease(Consumer<Releasable> task) {
777-
while (task != null) {
776+
do {
778777
final SubscribableListener<Void> onDone = new SubscribableListener<>();
779778
task.accept(() -> onDone.onResponse(null));
780779
if (onDone.isDone()) {
@@ -797,13 +796,21 @@ public void onFailure(Exception e) {
797796
});
798797
return;
799798
}
800-
}
799+
} while (task != null);
801800
}
802801

803802
private Consumer<Releasable> pollNextTaskOrReleasePermit() {
804803
var task = queue.poll();
805804
if (task == null) {
806805
semaphore.release();
806+
while (queue.peek() != null && semaphore.tryAcquire()) {
807+
task = queue.poll();
808+
if (task == null) {
809+
semaphore.release();
810+
} else {
811+
return task;
812+
}
813+
}
807814
}
808815
return task;
809816
}

server/src/main/java/org/elasticsearch/cluster/ClusterState.java

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
4848
import org.elasticsearch.core.Nullable;
4949
import org.elasticsearch.core.SuppressForbidden;
50+
import org.elasticsearch.core.UpdateForV9;
5051
import org.elasticsearch.index.shard.IndexLongFieldRange;
5152
import org.elasticsearch.indices.SystemIndexDescriptor;
5253
import org.elasticsearch.xcontent.ToXContent;
@@ -1025,52 +1026,25 @@ public static ClusterState readFrom(StreamInput in, DiscoveryNode localNode) thr
10251026
builder.metadata = Metadata.readFrom(in);
10261027
builder.routingTable = RoutingTable.readFrom(in);
10271028
builder.nodes = DiscoveryNodes.readFrom(in, localNode);
1028-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
1029-
builder.nodeIdsToCompatibilityVersions(in.readMap(CompatibilityVersions::readVersion));
1030-
} else {
1031-
// this clusterstate is from a pre-8.8.0 node
1032-
// infer the versions from discoverynodes for now
1033-
// leave mappings versions empty
1034-
builder.nodes()
1035-
.getNodes()
1036-
.values()
1037-
.forEach(n -> builder.putCompatibilityVersions(n.getId(), inferTransportVersion(n), Map.of()));
1038-
}
1039-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
1040-
builder.nodeFeatures(ClusterFeatures.readFrom(in));
1041-
}
1029+
builder.nodeIdsToCompatibilityVersions(in.readMap(CompatibilityVersions::readVersion));
1030+
builder.nodeFeatures(ClusterFeatures.readFrom(in));
10421031
builder.blocks = ClusterBlocks.readFrom(in);
10431032
int customSize = in.readVInt();
10441033
for (int i = 0; i < customSize; i++) {
10451034
Custom customIndexMetadata = in.readNamedWriteable(Custom.class);
10461035
builder.putCustom(customIndexMetadata.getWriteableName(), customIndexMetadata);
10471036
}
1048-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
1049-
in.readVInt(); // used to be minimumMasterNodesOnPublishingMaster, which was used in 7.x for BWC with 6.x
1050-
}
10511037
return builder.build();
10521038
}
10531039

10541040
/**
10551041
* If the cluster state does not contain transport version information, this is the version
10561042
* that is inferred for all nodes on version 8.8.0 or above.
10571043
*/
1044+
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
10581045
public static final TransportVersion INFERRED_TRANSPORT_VERSION = TransportVersions.V_8_8_0;
1059-
10601046
public static final Version VERSION_INTRODUCING_TRANSPORT_VERSIONS = Version.V_8_8_0;
10611047

1062-
private static TransportVersion inferTransportVersion(DiscoveryNode node) {
1063-
TransportVersion tv;
1064-
if (node.getVersion().before(VERSION_INTRODUCING_TRANSPORT_VERSIONS)) {
1065-
// 1-to-1 mapping between Version and TransportVersion
1066-
tv = TransportVersion.fromId(node.getPre811VersionId().getAsInt());
1067-
} else {
1068-
// use the lowest value it could be for now
1069-
tv = INFERRED_TRANSPORT_VERSION;
1070-
}
1071-
return tv;
1072-
}
1073-
10741048
@Override
10751049
public void writeTo(StreamOutput out) throws IOException {
10761050
clusterName.writeTo(out);
@@ -1079,17 +1053,10 @@ public void writeTo(StreamOutput out) throws IOException {
10791053
metadata.writeTo(out);
10801054
routingTable.writeTo(out);
10811055
nodes.writeTo(out);
1082-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
1083-
out.writeMap(compatibilityVersions, StreamOutput::writeWriteable);
1084-
}
1085-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
1086-
clusterFeatures.writeTo(out);
1087-
}
1056+
out.writeMap(compatibilityVersions, StreamOutput::writeWriteable);
1057+
clusterFeatures.writeTo(out);
10881058
blocks.writeTo(out);
10891059
VersionedNamedWriteable.writeVersionedWritables(out, customs);
1090-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
1091-
out.writeVInt(-1); // used to be minimumMasterNodesOnPublishingMaster, which was used in 7.x for BWC with 6.x
1092-
}
10931060
}
10941061

10951062
private static class ClusterStateDiff implements Diff<ClusterState> {
@@ -1106,7 +1073,6 @@ private static class ClusterStateDiff implements Diff<ClusterState> {
11061073

11071074
private final Diff<DiscoveryNodes> nodes;
11081075

1109-
@Nullable
11101076
private final Diff<Map<String, CompatibilityVersions>> versions;
11111077
private final Diff<ClusterFeatures> features;
11121078

@@ -1142,26 +1108,13 @@ private static class ClusterStateDiff implements Diff<ClusterState> {
11421108
toVersion = in.readLong();
11431109
routingTable = RoutingTable.readDiffFrom(in);
11441110
nodes = DiscoveryNodes.readDiffFrom(in, localNode);
1145-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0) && in.readBoolean()) {
1146-
versions = DiffableUtils.readJdkMapDiff(
1147-
in,
1148-
DiffableUtils.getStringKeySerializer(),
1149-
COMPATIBILITY_VERSIONS_VALUE_SERIALIZER
1150-
);
1151-
} else {
1152-
versions = null; // infer at application time
1153-
}
1154-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
1155-
features = ClusterFeatures.readDiffFrom(in);
1156-
} else {
1157-
features = null; // fill in when nodes re-register with a master that understands features
1158-
}
1111+
boolean versionPresent = in.readBoolean();
1112+
if (versionPresent == false) throw new IOException("ClusterStateDiff stream must have versions");
1113+
versions = DiffableUtils.readJdkMapDiff(in, DiffableUtils.getStringKeySerializer(), COMPATIBILITY_VERSIONS_VALUE_SERIALIZER);
1114+
features = ClusterFeatures.readDiffFrom(in);
11591115
metadata = Metadata.readDiffFrom(in);
11601116
blocks = ClusterBlocks.readDiffFrom(in);
11611117
customs = DiffableUtils.readJdkMapDiff(in, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER);
1162-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
1163-
in.readVInt(); // used to be minimumMasterNodesOnPublishingMaster, which was used in 7.x for BWC with 6.x
1164-
}
11651118
}
11661119

11671120
@Override
@@ -1172,18 +1125,12 @@ public void writeTo(StreamOutput out) throws IOException {
11721125
out.writeLong(toVersion);
11731126
routingTable.writeTo(out);
11741127
nodes.writeTo(out);
1175-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
1176-
out.writeOptionalWriteable(versions);
1177-
}
1178-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
1179-
features.writeTo(out);
1180-
}
1128+
out.writeBoolean(true);
1129+
versions.writeTo(out);
1130+
features.writeTo(out);
11811131
metadata.writeTo(out);
11821132
blocks.writeTo(out);
11831133
customs.writeTo(out);
1184-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
1185-
out.writeVInt(-1); // used to be minimumMasterNodesOnPublishingMaster, which was used in 7.x for BWC with 6.x
1186-
}
11871134
}
11881135

11891136
@Override
@@ -1200,19 +1147,8 @@ public ClusterState apply(ClusterState state) {
12001147
builder.version(toVersion);
12011148
builder.routingTable(routingTable.apply(state.routingTable));
12021149
builder.nodes(nodes.apply(state.nodes));
1203-
if (versions != null) {
1204-
builder.nodeIdsToCompatibilityVersions(this.versions.apply(state.compatibilityVersions));
1205-
} else {
1206-
// infer the versions from discoverynodes for now
1207-
// leave mappings versions empty
1208-
builder.nodes()
1209-
.getNodes()
1210-
.values()
1211-
.forEach(n -> builder.putCompatibilityVersions(n.getId(), inferTransportVersion(n), Map.of()));
1212-
}
1213-
if (features != null) {
1214-
builder.nodeFeatures(this.features.apply(state.clusterFeatures));
1215-
}
1150+
builder.nodeIdsToCompatibilityVersions(this.versions.apply(state.compatibilityVersions));
1151+
builder.nodeFeatures(this.features.apply(state.clusterFeatures));
12161152
builder.metadata(metadata.apply(state.metadata));
12171153
builder.blocks(blocks.apply(state.blocks));
12181154
builder.customs(customs.apply(state.customs));

server/src/main/java/org/elasticsearch/cluster/coordination/JoinRequest.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
*/
99
package org.elasticsearch.cluster.coordination;
1010

11-
import org.elasticsearch.TransportVersion;
12-
import org.elasticsearch.TransportVersions;
1311
import org.elasticsearch.cluster.node.DiscoveryNode;
1412
import org.elasticsearch.cluster.version.CompatibilityVersions;
1513
import org.elasticsearch.common.io.stream.StreamInput;
1614
import org.elasticsearch.common.io.stream.StreamOutput;
1715
import org.elasticsearch.transport.TransportRequest;
1816

1917
import java.io.IOException;
20-
import java.util.Map;
2118
import java.util.Objects;
2219
import java.util.Optional;
2320
import java.util.Set;
@@ -72,21 +69,8 @@ public JoinRequest(
7269
public JoinRequest(StreamInput in) throws IOException {
7370
super(in);
7471
sourceNode = new DiscoveryNode(in);
75-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
76-
compatibilityVersions = CompatibilityVersions.readVersion(in);
77-
} else {
78-
// there's a 1-1 mapping from Version to TransportVersion before 8.8.0
79-
// no known mapping versions here
80-
compatibilityVersions = new CompatibilityVersions(
81-
TransportVersion.fromId(sourceNode.getPre811VersionId().getAsInt()),
82-
Map.of()
83-
);
84-
}
85-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
86-
features = in.readCollectionAsSet(StreamInput::readString);
87-
} else {
88-
features = Set.of();
89-
}
72+
compatibilityVersions = CompatibilityVersions.readVersion(in);
73+
features = in.readCollectionAsSet(StreamInput::readString);
9074
minimumTerm = in.readLong();
9175
optionalJoin = Optional.ofNullable(in.readOptionalWriteable(Join::new));
9276
}
@@ -95,12 +79,8 @@ public JoinRequest(StreamInput in) throws IOException {
9579
public void writeTo(StreamOutput out) throws IOException {
9680
super.writeTo(out);
9781
sourceNode.writeTo(out);
98-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
99-
compatibilityVersions.writeTo(out);
100-
}
101-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
102-
out.writeCollection(features, StreamOutput::writeString);
103-
}
82+
compatibilityVersions.writeTo(out);
83+
out.writeCollection(features, StreamOutput::writeString);
10484
out.writeLong(minimumTerm);
10585
out.writeOptionalWriteable(optionalJoin.orElse(null));
10686
}

0 commit comments

Comments
 (0)