Skip to content

Commit 8ef2ef1

Browse files
authored
Merge branch 'main' into model_registry_compatible_version
2 parents 3060c05 + a16eaf1 commit 8ef2ef1

File tree

17 files changed

+600
-82
lines changed

17 files changed

+600
-82
lines changed

.buildkite/hooks/pre-command

Lines changed: 8 additions & 0 deletions
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

Lines changed: 34 additions & 2 deletions
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/122250.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 122250
2+
summary: "ESQL: Align `RENAME` behavior with `EVAL` for sequential processing"
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 121739

docs/changelog/125171.yaml

Lines changed: 5 additions & 0 deletions
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: []

muted-tests.yml

Lines changed: 6 additions & 6 deletions
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,12 @@ 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
402+
- class: org.elasticsearch.index.mapper.NativeArrayIntegrationTestCase
403+
method: testSynthesizeArrayRandomIgnoresMalformed
404+
issue: https://github.com/elastic/elasticsearch/issues/125319
405405

406406
# Examples:
407407
#

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

Lines changed: 44 additions & 4 deletions
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

Lines changed: 1 addition & 5 deletions
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/index/codec/PerFieldFormatSupplier.java

Lines changed: 2 additions & 18 deletions
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

Lines changed: 0 additions & 28 deletions
This file was deleted.

x-pack/plugin/esql/qa/testFixtures/src/main/resources/rename.csv-spec

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,85 @@ x:keyword
214214
Facello
215215
Simmel
216216
;
217+
218+
swappingNames
219+
required_capability: rename_sequential_processing
220+
FROM employees
221+
| SORT emp_no ASC
222+
| KEEP first_name, last_name
223+
| RENAME first_name AS last_name, last_name AS first_name, first_name as name
224+
| LIMIT 2
225+
;
226+
227+
name:keyword
228+
Georgi
229+
Bezalel
230+
;
231+
232+
complexSwappingNames
233+
required_capability: rename_sequential_processing
234+
FROM employees
235+
| SORT emp_no ASC
236+
| KEEP first_name, last_name, emp_no
237+
| RENAME first_name AS last_name, last_name AS first_name, first_name as emp_no, emp_no AS first_name
238+
| LIMIT 2
239+
;
240+
241+
first_name:keyword
242+
Georgi
243+
Bezalel
244+
;
245+
246+
247+
reuseRenamedAlias
248+
required_capability: rename_sequential_processing
249+
FROM employees
250+
| SORT emp_no ASC
251+
| KEEP first_name, last_name
252+
| LIMIT 2
253+
| RENAME first_name AS x, x AS y, last_name as x
254+
;
255+
256+
y:keyword | x:keyword
257+
Georgi | Facello
258+
Bezalel | Simmel
259+
;
260+
261+
262+
multipleRenamesToSameAliasLastOnePrevails
263+
required_capability: rename_sequential_processing
264+
FROM employees
265+
| SORT emp_no ASC
266+
| KEEP first_name, last_name
267+
| LIMIT 2
268+
| RENAME first_name AS x, last_name as x
269+
;
270+
271+
x:keyword
272+
Facello
273+
Simmel
274+
;
275+
276+
277+
swapNames
278+
required_capability: rename_sequential_processing
279+
ROW a="keyword", b=5
280+
| RENAME a AS temp, b AS a, temp AS b
281+
;
282+
283+
b:keyword | a:integer
284+
keyword | 5
285+
;
286+
287+
288+
multipleRenames
289+
required_capability: rename_sequential_processing
290+
ROW a="keyword", b=5, c=null
291+
| RENAME a AS c, b AS a
292+
| RENAME c AS b
293+
| RENAME a AS b, b AS a
294+
;
295+
296+
a:integer
297+
5
298+
;

0 commit comments

Comments
 (0)