Skip to content

Commit b4e3fa6

Browse files
Merge remote-tracking branch 'elastic/main' into batched-exec-short
2 parents a060542 + 56027da commit b4e3fa6

File tree

31 files changed

+377
-90
lines changed

31 files changed

+377
-90
lines changed

.buildkite/hooks/pre-command

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
9494
fi
9595
fi
9696

97+
# Authenticate to the Docker Hub public read-only registry
98+
if which docker > /dev/null 2>&1; then
99+
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
100+
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
101+
102+
echo "$DOCKERHUB_REGISTRY_PASSWORD" | docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password-stdin docker.io
103+
fi
104+
97105
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
98106
# Run in the background, while the job continues
99107
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

REST_API_COMPATIBILITY.md

+34-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("limit
154154

155155
The above code checks the request's compatible version and if the request has the parameter in question. In this case the deprecation warning is not automatic and requires the developer to manually log the warning. `request.param` is also required since it consumes the value as to avoid the error of unconsumed parameters.
156156

157-
### Testing
157+
### Testing Backwards Compatibility
158158

159-
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
159+
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. For example if you are testing main versioned as 9.0.0 the build system will download the yaml tests in the 8.x branch and execute those against the current cluster version for 9.0.0.
160+
161+
Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
160162

161163
The tests are wired into the `check` task, so that is the easiest way to test locally prior to committing. More specifically the task is called `yamlRestCompatTest`. These behave nearly identical to it's non-compat `yamlRestTest` task. The only variance is that the tests are sourced from the prior version branch and the tests go through a transformation phase before execution. The transformation task is `yamlRestCompatTestTransform`.
162164

@@ -170,6 +172,36 @@ Since these are a variation of backward compatibility testing, the entire suite
170172

171173
In some cases the prior version of the YAML REST tests are not sufficient to fully test changes. This can happen when the prior version has insufficient test coverage. In those cases, you can simply add more testing to the prior version or you can add custom REST tests that will run along side of the other compatibility tests. These custom tests can be found in the `yamlRestCompatTest` sourceset. Custom REST tests for compatibility will not be modified prior to execution, so the correct headers need to be manually added.
172174

175+
#### Breaking Changes
176+
177+
It is possible to be in a state where you have intentionally made a breaking change and the compatibility tests will fail irrespective of checks for `skip` or `requires` cluster or test features in the current version such as 9.0.0. In this state, assuming the breaking changes are reasonable and agreed upon by the breaking change committee, the correct behavior is to skip the test in the `build.gradle` in 9.0.0. For example, if you make a breaking change that causes the `range/20_synthetic_source/Date range` to break then this test can be disabled temporarily in this file `rest-api-spec/build.gradle` like within this snippet:
178+
179+
```groovy
180+
tasks.named("yamlRestCompatTestTransform").configure({task ->
181+
task.skipTest("range/20_synthetic_source/Date range", "date range breaking change causes tests to produce incorrect values for compatibility")
182+
task.skipTest("indices.sort/10_basic/Index Sort", "warning does not exist for compatibility")
183+
task.skipTest("search/330_fetch_fields/Test search rewrite", "warning does not exist for compatibility")
184+
task.skipTestsByFilePattern("indices.create/synthetic_source*.yml", "@UpdateForV9 -> tests do not pass after bumping API version to 9 [ES-9597]")
185+
})
186+
```
187+
188+
When skipping a test temporarily in 9.0.0, we have to implement the proper `skip` and `requires` conditions to previous branches, such as 8.latest. After these conditions are implemented in 8.latest, you can re-enable the test in 9.0.0 by removing the `skipTest` condition.
189+
190+
The team implementing the changes can decide how to clean up or modify tests based on how breaking changes were backported. e.g.:
191+
192+
In 8.latest:
193+
194+
* Add `skip` / `requires` conditions to existing tests that check the old behavior. This prevents those tests from failing during backward compatibility or upgrade testing from 8.latest to 9.0.0
195+
196+
In 9.0.0:
197+
198+
* Add `requires` conditions for new tests that validate the updated API or output format
199+
* Add `skip` conditions for older tests that would break in 9.0.0
200+
201+
#### Test Features
202+
203+
Both cluster and test features exist. Cluster features are meant for new capability and test features can specifically be used to gate and manage `skip` and `requires` yaml test operations. For more information, see [Versioning.md](docs/internal/Versioning.md#cluster-features). When backporting and using these features they can not overlap in name and must be consistent when backported so that clusters built with these features are compatible.
204+
173205
### Developer's workflow
174206

175207
There should not be much, if any, deviation in a developers normal workflow to introduce and back-port changes. Changes should be applied in main, then back ported as needed.

docs/changelog/124669.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pr: 124669
2+
summary: Release semantic_text as a GA feature
3+
area: Mapping
4+
type: feature
5+
issues: []
6+
highlight:
7+
title: Release semantic_text as a GA feature
8+
body: semantic_text is now an official GA (generally available) feature!
9+
This field type allows you to easily set up and perform semantic search with minimal ramp up time.
10+
notable: true

docs/changelog/125171.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125171
2+
summary: Reindex data stream indices on different nodes
3+
area: Data streams
4+
type: enhancement
5+
issues: []

docs/changelog/125244.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 125244
2+
summary: Disable logging in `ClusterFormationFailureHelper` on shutdown
3+
area: Cluster Coordination
4+
type: bug
5+
issues:
6+
- 105559

docs/reference/elasticsearch/mapping-reference/semantic-text.md

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ mapped_pages:
66

77
# Semantic text field type [semantic-text]
88

9-
10-
::::{warning}
11-
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
12-
::::
13-
14-
159
The `semantic_text` field type automatically generates embeddings for text content using an inference endpoint. Long passages are [automatically chunked](#auto-text-chunking) to smaller sections to enable the processing of larger corpuses of text.
1610

1711
The `semantic_text` field type specifies an inference endpoint identifier that will be used to generate embeddings. You can create the inference endpoint by using the [Create {{infer}} API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put). This field type and the [`semantic` query](/reference/query-languages/query-dsl/query-dsl-semantic-query.md) type make it simpler to perform semantic search on your data. The `semantic_text` field type may also be queried with [match](/reference/query-languages/query-dsl/query-dsl-match-query.md), [sparse_vector](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md) or [knn](/reference/query-languages/query-dsl/query-dsl-knn-query.md) queries.

docs/reference/query-languages/query-dsl/query-dsl-semantic-query.md

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ mapped_pages:
66

77
# Semantic query [query-dsl-semantic-query]
88

9-
10-
::::{warning}
11-
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
12-
::::
13-
14-
159
The `semantic` query type enables you to perform [semantic search](docs-content://solutions/search/semantic-search.md) on data stored in a [`semantic_text`](/reference/elasticsearch/mapping-reference/semantic-text.md) field.
1610

1711

muted-tests.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,6 @@ tests:
360360
- class: org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT
361361
method: testErrorRecordingOnRetention
362362
issue: https://github.com/elastic/elasticsearch/issues/124950
363-
- class: org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT
364-
method: test {lookup-join.MvJoinKeyFromRow SYNC}
365-
issue: https://github.com/elastic/elasticsearch/issues/124951
366363
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
367364
method: testStopQueryLocalNoRemotes
368365
issue: https://github.com/elastic/elasticsearch/issues/124959
@@ -387,9 +384,6 @@ tests:
387384
- class: org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT
388385
method: testLifecycleAppliedToFailureStore
389386
issue: https://github.com/elastic/elasticsearch/issues/124999
390-
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
391-
method: test {p0=search/610_function_score/Random}
392-
issue: https://github.com/elastic/elasticsearch/issues/125010
393387
- class: org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests
394388
method: testGetDataStreamResponse
395389
issue: https://github.com/elastic/elasticsearch/issues/125083
@@ -402,6 +396,9 @@ tests:
402396
- class: org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests
403397
method: testSchedulerCloseWaitsForRunningMerge
404398
issue: https://github.com/elastic/elasticsearch/issues/125236
399+
- class: org.elasticsearch.reservedstate.service.ReservedClusterStateServiceTests
400+
method: testProcessMultipleChunks
401+
issue: https://github.com/elastic/elasticsearch/issues/125305
405402

406403
# Examples:
407404
#

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml

+44-4
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,55 @@
7171
}
7272
},
7373
"random_score": {
74-
"seed": 10
74+
"seed": 10,
75+
"field": "uuid"
7576
}
7677
}
7778

7879
- length: { hits.hits: 2 }
7980
- match: { hits.total.value: 2 }
8081

82+
---
83+
"No field only runs on 9.x":
84+
- requires:
85+
cluster_features: [ "gte_v9.0.0" ]
86+
reason: "empty field works seamlessly (relying on _seqno since 9.x)"
87+
- do:
88+
indices.create:
89+
index: test
90+
body:
91+
mappings:
92+
properties:
93+
text:
94+
type: text
95+
96+
- do:
97+
index:
98+
index: test
99+
id: "1"
100+
body: { text: "foo bar", uuid: 1234 }
101+
102+
- do:
103+
index:
104+
index: test
105+
id: "2"
106+
body: { text: "high bar", uuid: 5678 }
107+
108+
- do:
109+
index:
110+
index: test
111+
id: "3"
112+
body: { text: "raise bar", uuid: 9012 }
113+
114+
- do:
115+
index:
116+
index: test
117+
id: "3"
118+
body: { text: "raise hands", uuid: 3456 }
119+
120+
- do:
121+
indices.refresh:
122+
index: [ test ]
81123
- do:
82124
search:
83125
index: test
@@ -91,10 +133,8 @@
91133
}
92134
},
93135
"random_score": {
94-
"seed": 10,
95-
"field": "uuid"
136+
"seed": 10
96137
}
97138
}
98-
99139
- length: { hits.hits: 2 }
100140
- match: { hits.total.value: 2 }

server/src/main/java/module-info.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import org.elasticsearch.internal.CompletionsPostingsFormatExtension;
1110
import org.elasticsearch.plugins.internal.RestExtension;
1211

1312
/** The Elasticsearch Server Module. */
@@ -291,8 +290,7 @@
291290
to
292291
org.elasticsearch.serverless.version,
293292
org.elasticsearch.serverless.buildinfo,
294-
org.elasticsearch.serverless.constants,
295-
org.elasticsearch.serverless.codec;
293+
org.elasticsearch.serverless.constants;
296294
exports org.elasticsearch.lucene.analysis.miscellaneous;
297295
exports org.elasticsearch.lucene.grouping;
298296
exports org.elasticsearch.lucene.queries;
@@ -401,7 +399,6 @@
401399
org.elasticsearch.stateless,
402400
org.elasticsearch.settings.secure,
403401
org.elasticsearch.serverless.constants,
404-
org.elasticsearch.serverless.codec,
405402
org.elasticsearch.serverless.apifiltering,
406403
org.elasticsearch.internal.security;
407404

@@ -422,7 +419,6 @@
422419
uses org.elasticsearch.node.internal.TerminationHandlerProvider;
423420
uses org.elasticsearch.internal.VersionExtension;
424421
uses org.elasticsearch.internal.BuildExtension;
425-
uses CompletionsPostingsFormatExtension;
426422
uses org.elasticsearch.features.FeatureSpecification;
427423
uses org.elasticsearch.plugins.internal.LoggingDataProvider;
428424

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class ClusterFormationFailureHelper {
6868
private final Runnable logLastFailedJoinAttempt;
6969
@Nullable // if no warning is scheduled
7070
private volatile WarningScheduler warningScheduler;
71+
private volatile boolean loggingEnabled;
7172

7273
/**
7374
* Works with the {@link JoinHelper} to log the latest node-join attempt failure and cluster state debug information. Must call
@@ -90,6 +91,11 @@ public ClusterFormationFailureHelper(
9091
this.clusterCoordinationExecutor = threadPool.executor(Names.CLUSTER_COORDINATION);
9192
this.clusterFormationWarningTimeout = DISCOVERY_CLUSTER_FORMATION_WARNING_TIMEOUT_SETTING.get(settings);
9293
this.logLastFailedJoinAttempt = logLastFailedJoinAttempt;
94+
this.loggingEnabled = true;
95+
}
96+
97+
public void setLoggingEnabled(boolean enabled) {
98+
this.loggingEnabled = enabled;
9399
}
94100

95101
public boolean isRunning() {
@@ -98,7 +104,7 @@ public boolean isRunning() {
98104

99105
/**
100106
* Schedules a warning debug message to be logged in 'clusterFormationWarningTimeout' time, and periodically thereafter, until
101-
* {@link ClusterFormationState#stop()} has been called.
107+
* {@link ClusterFormationFailureHelper#stop()} has been called.
102108
*/
103109
public void start() {
104110
assert warningScheduler == null;
@@ -125,7 +131,7 @@ public void onFailure(Exception e) {
125131

126132
@Override
127133
protected void doRun() {
128-
if (isActive()) {
134+
if (isActive() && loggingEnabled) {
129135
logLastFailedJoinAttempt.run();
130136
logger.warn(
131137
"{}; for troubleshooting guidance, see {}",

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

+2
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@ protected void doStart() {
11041104
applierState = initialState;
11051105
clusterApplier.setInitialState(initialState);
11061106
}
1107+
clusterFormationFailureHelper.setLoggingEnabled(true);
11071108
}
11081109

11091110
public DiscoveryStats stats() {
@@ -1126,6 +1127,7 @@ public void startInitialJoin() {
11261127
protected void doStop() {
11271128
configuredHostsResolver.stop();
11281129
joinValidationService.stop();
1130+
clusterFormationFailureHelper.setLoggingEnabled(false);
11291131
}
11301132

11311133
@Override

server/src/main/java/org/elasticsearch/cluster/metadata/ProjectId.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static ProjectId fromId(String id) {
5454
}
5555
}
5656

57-
static boolean isValidFormatId(String id) {
57+
public static boolean isValidFormatId(String id) {
5858
if (id.length() > MAX_LENGTH) {
5959
return false;
6060
}

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

+2-18
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
import org.elasticsearch.index.mapper.Mapper;
2626
import org.elasticsearch.index.mapper.MapperService;
2727
import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper;
28-
import org.elasticsearch.internal.CompletionsPostingsFormatExtension;
29-
import org.elasticsearch.plugins.ExtensionLoader;
30-
31-
import java.util.ServiceLoader;
3228

3329
/**
3430
* Class that encapsulates the logic of figuring out the most appropriate file format for a given field, across postings, doc values and
@@ -40,6 +36,7 @@ public class PerFieldFormatSupplier {
4036
private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat();
4137
private static final ES87TSDBDocValuesFormat tsdbDocValuesFormat = new ES87TSDBDocValuesFormat();
4238
private static final ES812PostingsFormat es812PostingsFormat = new ES812PostingsFormat();
39+
private static final PostingsFormat completionPostingsFormat = PostingsFormat.forName("Completion101");
4340

4441
private final ES87BloomFilterPostingsFormat bloomFilterPostingsFormat;
4542
private final MapperService mapperService;
@@ -60,26 +57,13 @@ private PostingsFormat internalGetPostingsFormatForField(String field) {
6057
if (mapperService != null) {
6158
Mapper mapper = mapperService.mappingLookup().getMapper(field);
6259
if (mapper instanceof CompletionFieldMapper) {
63-
return CompletionPostingsFormatHolder.POSTINGS_FORMAT;
60+
return completionPostingsFormat;
6461
}
6562
}
6663
// return our own posting format using PFOR
6764
return es812PostingsFormat;
6865
}
6966

70-
private static class CompletionPostingsFormatHolder {
71-
private static final PostingsFormat POSTINGS_FORMAT = getCompletionPostingsFormat();
72-
73-
private static PostingsFormat getCompletionPostingsFormat() {
74-
String defaultName = "Completion101"; // Caution: changing this name will result in exceptions if a field is created during a
75-
// rolling upgrade and the new codec (specified by the name) is not available on all nodes in the cluster.
76-
String codecName = ExtensionLoader.loadSingleton(ServiceLoader.load(CompletionsPostingsFormatExtension.class))
77-
.map(CompletionsPostingsFormatExtension::getFormatName)
78-
.orElse(defaultName);
79-
return PostingsFormat.forName(codecName);
80-
}
81-
}
82-
8367
boolean useBloomFilter(String field) {
8468
if (mapperService == null) {
8569
return false;

server/src/main/java/org/elasticsearch/internal/CompletionsPostingsFormatExtension.java

-28
This file was deleted.

0 commit comments

Comments
 (0)