Skip to content

Commit 67e6d3b

Browse files
committed
Merge remote-tracking branch 'origin/main' into indexing_presssure_operation_mutability
2 parents 9f0e0b7 + 3c18ea6 commit 67e6d3b

File tree

209 files changed

+3793
-1354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+3793
-1354
lines changed

.buildkite/pipelines/intake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ steps:
5656
timeout_in_minutes: 300
5757
matrix:
5858
setup:
59-
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
59+
BWC_VERSION: ["8.16.5", "8.17.3", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
6060
agents:
6161
provider: gcp
6262
image: family/elasticsearch-ubuntu-2004

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ steps:
287287
env:
288288
BWC_VERSION: 8.15.5
289289

290-
- label: "{{matrix.image}} / 8.16.4 / packaging-tests-upgrade"
291-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.16.4
290+
- label: "{{matrix.image}} / 8.16.5 / packaging-tests-upgrade"
291+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.16.5
292292
timeout_in_minutes: 300
293293
matrix:
294294
setup:
@@ -301,10 +301,10 @@ steps:
301301
machineType: custom-16-32768
302302
buildDirectory: /dev/shm/bk
303303
env:
304-
BWC_VERSION: 8.16.4
304+
BWC_VERSION: 8.16.5
305305

306-
- label: "{{matrix.image}} / 8.17.2 / packaging-tests-upgrade"
307-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.17.2
306+
- label: "{{matrix.image}} / 8.17.3 / packaging-tests-upgrade"
307+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.17.3
308308
timeout_in_minutes: 300
309309
matrix:
310310
setup:
@@ -317,7 +317,7 @@ steps:
317317
machineType: custom-16-32768
318318
buildDirectory: /dev/shm/bk
319319
env:
320-
BWC_VERSION: 8.17.2
320+
BWC_VERSION: 8.17.3
321321

322322
- label: "{{matrix.image}} / 8.18.0 / packaging-tests-upgrade"
323323
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.18.0

.buildkite/pipelines/periodic.template.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ steps:
7878
BWC_VERSION: "{{matrix.BWC_VERSION}}"
7979
- group: java-matrix
8080
steps:
81-
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.GRADLE_TASK}} / java-matrix"
82-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true $$GRADLE_TASK
81+
- label: "{{matrix.ES_RUNTIME_JAVA}} / entitlements={{matrix.ENTITLEMENTS_ENABLED}} / {{matrix.GRADLE_TASK}} / java-matrix"
82+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dtests.jvm.argline="-Des.entitlements.enabled=$$ENTITLEMENTS_ENABLED" $$GRADLE_TASK
8383
timeout_in_minutes: 300
8484
matrix:
8585
setup:
@@ -94,6 +94,9 @@ steps:
9494
- checkPart4
9595
- checkPart5
9696
- checkRestCompat
97+
ENTITLEMENTS_ENABLED:
98+
- "true"
99+
- "false"
97100
agents:
98101
provider: gcp
99102
image: family/elasticsearch-ubuntu-2004
@@ -102,6 +105,7 @@ steps:
102105
env:
103106
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
104107
GRADLE_TASK: "{{matrix.GRADLE_TASK}}"
108+
ENTITLEMENTS_ENABLED: "{{matrix.ENTITLEMENTS_ENABLED}}"
105109
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.BWC_VERSION}} / java-matrix-bwc"
106110
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$BWC_VERSION#bwcTest
107111
timeout_in_minutes: 300

.buildkite/pipelines/periodic.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ steps:
306306
- signal_reason: agent_stop
307307
limit: 3
308308

309-
- label: 8.16.4 / bwc
310-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.4#bwcTest
309+
- label: 8.16.5 / bwc
310+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.5#bwcTest
311311
timeout_in_minutes: 300
312312
agents:
313313
provider: gcp
@@ -316,7 +316,7 @@ steps:
316316
buildDirectory: /dev/shm/bk
317317
preemptible: true
318318
env:
319-
BWC_VERSION: 8.16.4
319+
BWC_VERSION: 8.16.5
320320
retry:
321321
automatic:
322322
- exit_status: "-1"
@@ -325,8 +325,8 @@ steps:
325325
- signal_reason: agent_stop
326326
limit: 3
327327

328-
- label: 8.17.2 / bwc
329-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.17.2#bwcTest
328+
- label: 8.17.3 / bwc
329+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.17.3#bwcTest
330330
timeout_in_minutes: 300
331331
agents:
332332
provider: gcp
@@ -335,7 +335,7 @@ steps:
335335
buildDirectory: /dev/shm/bk
336336
preemptible: true
337337
env:
338-
BWC_VERSION: 8.17.2
338+
BWC_VERSION: 8.17.3
339339
retry:
340340
automatic:
341341
- exit_status: "-1"
@@ -486,7 +486,7 @@ steps:
486486
setup:
487487
ES_RUNTIME_JAVA:
488488
- openjdk21
489-
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
489+
BWC_VERSION: ["8.16.5", "8.17.3", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
490490
agents:
491491
provider: gcp
492492
image: family/elasticsearch-ubuntu-2004
@@ -497,8 +497,8 @@ steps:
497497
BWC_VERSION: "{{matrix.BWC_VERSION}}"
498498
- group: java-matrix
499499
steps:
500-
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.GRADLE_TASK}} / java-matrix"
501-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true $$GRADLE_TASK
500+
- label: "{{matrix.ES_RUNTIME_JAVA}} / entitlements={{matrix.ENTITLEMENTS_ENABLED}} / {{matrix.GRADLE_TASK}} / java-matrix"
501+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dtests.jvm.argline="-Des.entitlements.enabled=$$ENTITLEMENTS_ENABLED" $$GRADLE_TASK
502502
timeout_in_minutes: 300
503503
matrix:
504504
setup:
@@ -513,6 +513,9 @@ steps:
513513
- checkPart4
514514
- checkPart5
515515
- checkRestCompat
516+
ENTITLEMENTS_ENABLED:
517+
- "true"
518+
- "false"
516519
agents:
517520
provider: gcp
518521
image: family/elasticsearch-ubuntu-2004
@@ -521,6 +524,7 @@ steps:
521524
env:
522525
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
523526
GRADLE_TASK: "{{matrix.GRADLE_TASK}}"
527+
ENTITLEMENTS_ENABLED: "{{matrix.ENTITLEMENTS_ENABLED}}"
524528
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.BWC_VERSION}} / java-matrix-bwc"
525529
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$BWC_VERSION#bwcTest
526530
timeout_in_minutes: 300
@@ -529,7 +533,7 @@ steps:
529533
ES_RUNTIME_JAVA:
530534
- openjdk21
531535
- openjdk23
532-
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
536+
BWC_VERSION: ["8.16.5", "8.17.3", "8.18.0", "8.19.0", "9.0.0", "9.1.0"]
533537
agents:
534538
provider: gcp
535539
image: family/elasticsearch-ubuntu-2004

.ci/bwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ BWC_VERSION:
1515
- "8.13.4"
1616
- "8.14.3"
1717
- "8.15.5"
18-
- "8.16.4"
19-
- "8.17.2"
18+
- "8.16.5"
19+
- "8.17.3"
2020
- "8.18.0"
2121
- "8.19.0"
2222
- "9.0.0"

.ci/snapshotBwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BWC_VERSION:
2-
- "8.16.4"
3-
- "8.17.2"
2+
- "8.16.5"
3+
- "8.17.3"
44
- "8.18.0"
55
- "8.19.0"
66
- "9.0.0"

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/ValuesSourceReaderBenchmark.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ private static BlockLoader numericBlockLoader(WhereAndBaseName w, NumberFieldMap
261261
null,
262262
false,
263263
null,
264-
null
264+
null,
265+
false
265266
).blockLoader(null);
266267
}
267268

benchmarks/src/main/java/org/elasticsearch/benchmark/script/ScriptScoreBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class ScriptScoreBenchmark {
8383
private final ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, pluginsService.filterPlugins(ScriptPlugin.class).toList());
8484

8585
private final Map<String, MappedFieldType> fieldTypes = Map.ofEntries(
86-
Map.entry("n", new NumberFieldType("n", NumberType.LONG, false, false, true, true, null, Map.of(), null, false, null, null))
86+
Map.entry("n", new NumberFieldType("n", NumberType.LONG, false, false, true, true, null, Map.of(), null, false, null, null, false))
8787
);
8888
private final IndexFieldDataCache fieldDataCache = new IndexFieldDataCache.None();
8989
private final CircuitBreakerService breakerService = new NoneCircuitBreakerService();

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public enum DockerBase {
2222
// Chainguard based wolfi image with latest jdk
2323
// This is usually updated via renovatebot
2424
// spotless:off
25-
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bd401704a162a7937cd1015f755ca9da9aba0fdf967fc6bf90bf8d3f6b2eb557",
25+
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:ecd940be9f342ee6173397c48f3df5bb410e95000f8726fd01759b6c39b0beda",
2626
"-wolfi",
2727
"apk"
2828
),

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateVersionsTask.java

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
1616
import com.github.javaparser.ast.body.FieldDeclaration;
1717
import com.github.javaparser.ast.body.VariableDeclarator;
18+
import com.github.javaparser.ast.expr.Expression;
1819
import com.github.javaparser.ast.expr.NameExpr;
1920
import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter;
2021
import com.google.common.annotations.VisibleForTesting;
@@ -33,6 +34,7 @@
3334
import java.util.Objects;
3435
import java.util.Optional;
3536
import java.util.TreeMap;
37+
import java.util.function.Function;
3638
import java.util.regex.Matcher;
3739
import java.util.regex.Pattern;
3840
import java.util.stream.Collectors;
@@ -51,6 +53,8 @@ public class UpdateVersionsTask extends AbstractVersionsTask {
5153
private boolean setCurrent;
5254
@Nullable
5355
private Version removeVersion;
56+
@Nullable
57+
private String addTransportVersion;
5458

5559
@Inject
5660
public UpdateVersionsTask(BuildLayout layout) {
@@ -62,6 +66,11 @@ public void addVersion(String version) {
6266
this.addVersion = Version.fromString(version);
6367
}
6468

69+
@Option(option = "add-transport-version", description = "Specifies transport version to add")
70+
public void addTransportVersion(String transportVersion) {
71+
this.addTransportVersion = transportVersion;
72+
}
73+
6574
@Option(option = "set-current", description = "Set the 'current' constant to the new version")
6675
public void setCurrent(boolean setCurrent) {
6776
this.setCurrent = setCurrent;
@@ -87,15 +96,18 @@ static Optional<Version> parseVersionField(CharSequence field) {
8796

8897
@TaskAction
8998
public void executeTask() throws IOException {
90-
if (addVersion == null && removeVersion == null) {
99+
if (addVersion == null && removeVersion == null && addTransportVersion == null) {
91100
throw new IllegalArgumentException("No versions to add or remove specified");
92101
}
93102
if (setCurrent && addVersion == null) {
94103
throw new IllegalArgumentException("No new version added to set as the current version");
95104
}
96-
if (Objects.equals(addVersion, removeVersion)) {
105+
if (addVersion != null && removeVersion != null && Objects.equals(addVersion, removeVersion)) {
97106
throw new IllegalArgumentException("Same version specified to add and remove");
98107
}
108+
if (addTransportVersion != null && addTransportVersion.split(":").length != 2) {
109+
throw new IllegalArgumentException("Transport version specified must be in the format '<constant>:<version-id>'");
110+
}
99111

100112
Path versionJava = rootDir.resolve(VERSION_FILE_PATH);
101113
CompilationUnit file = LexicalPreservingPrinter.setup(StaticJavaParser.parse(versionJava));
@@ -115,6 +127,18 @@ public void executeTask() throws IOException {
115127
modifiedFile = removed;
116128
}
117129
}
130+
if (addTransportVersion != null) {
131+
var constant = addTransportVersion.split(":")[0];
132+
var versionId = Integer.parseInt(addTransportVersion.split(":")[1]);
133+
LOGGER.lifecycle("Adding transport version constant [{}] with id [{}]", constant, versionId);
134+
135+
var transportVersionsFile = rootDir.resolve(TRANSPORT_VERSIONS_FILE_PATH);
136+
var transportVersions = LexicalPreservingPrinter.setup(StaticJavaParser.parse(transportVersionsFile));
137+
var modified = addTransportVersionConstant(transportVersions, constant, versionId);
138+
if (modified.isPresent()) {
139+
writeOutNewContents(transportVersionsFile, modified.get());
140+
}
141+
}
118142

119143
if (modifiedFile.isPresent()) {
120144
writeOutNewContents(versionJava, modifiedFile.get());
@@ -161,6 +185,51 @@ static Optional<CompilationUnit> addVersionConstant(CompilationUnit versionJava,
161185
return Optional.of(versionJava);
162186
}
163187

188+
@VisibleForTesting
189+
static Optional<CompilationUnit> addTransportVersionConstant(CompilationUnit transportVersions, String constant, int versionId) {
190+
ClassOrInterfaceDeclaration transportVersionsClass = transportVersions.getClassByName("TransportVersions").get();
191+
if (transportVersionsClass.getFieldByName(constant).isPresent()) {
192+
LOGGER.lifecycle("New transport version constant [{}] already present, skipping", constant);
193+
return Optional.empty();
194+
}
195+
196+
TreeMap<Integer, FieldDeclaration> versions = transportVersionsClass.getFields()
197+
.stream()
198+
.filter(f -> f.getElementType().asString().equals("TransportVersion"))
199+
.filter(
200+
f -> f.getVariables().stream().limit(1).allMatch(v -> v.getInitializer().filter(Expression::isMethodCallExpr).isPresent())
201+
)
202+
.filter(f -> f.getVariable(0).getInitializer().get().asMethodCallExpr().getNameAsString().endsWith("def"))
203+
.collect(
204+
Collectors.toMap(
205+
f -> f.getVariable(0)
206+
.getInitializer()
207+
.get()
208+
.asMethodCallExpr()
209+
.getArgument(0)
210+
.asIntegerLiteralExpr()
211+
.asNumber()
212+
.intValue(),
213+
Function.identity(),
214+
(f1, f2) -> {
215+
throw new IllegalStateException("Duplicate version constant " + f1);
216+
},
217+
TreeMap::new
218+
)
219+
);
220+
221+
// find the version this should be inserted after
222+
Map.Entry<Integer, FieldDeclaration> previousVersion = versions.lowerEntry(versionId);
223+
if (previousVersion == null) {
224+
throw new IllegalStateException(String.format("Could not find previous version to [%s]", versionId));
225+
}
226+
227+
FieldDeclaration newTransportVersion = createNewTransportVersionConstant(previousVersion.getValue(), constant, versionId);
228+
transportVersionsClass.getMembers().addAfter(newTransportVersion, previousVersion.getValue());
229+
230+
return Optional.of(transportVersions);
231+
}
232+
164233
private static FieldDeclaration createNewVersionConstant(FieldDeclaration lastVersion, String newName, String newExpr) {
165234
return new FieldDeclaration(
166235
new NodeList<>(lastVersion.getModifiers()),
@@ -172,6 +241,29 @@ private static FieldDeclaration createNewVersionConstant(FieldDeclaration lastVe
172241
);
173242
}
174243

244+
private static FieldDeclaration createNewTransportVersionConstant(FieldDeclaration lastVersion, String newName, int newId) {
245+
return new FieldDeclaration(
246+
new NodeList<>(lastVersion.getModifiers()),
247+
new VariableDeclarator(
248+
lastVersion.getCommonType(),
249+
newName,
250+
StaticJavaParser.parseExpression(String.format("def(%s)", formatTransportVersionId(newId)))
251+
)
252+
);
253+
}
254+
255+
private static String formatTransportVersionId(int id) {
256+
String idString = Integer.toString(id);
257+
258+
return new StringBuilder(idString.substring(idString.length() - 2, idString.length())).insert(0, "_")
259+
.insert(0, idString.substring(idString.length() - 3, idString.length() - 2))
260+
.insert(0, "_")
261+
.insert(0, idString.substring(idString.length() - 6, idString.length() - 3))
262+
.insert(0, "_")
263+
.insert(0, idString.substring(0, idString.length() - 6))
264+
.toString();
265+
}
266+
175267
@VisibleForTesting
176268
static Optional<CompilationUnit> removeVersionConstant(CompilationUnit versionJava, Version version) {
177269
String removeFieldName = toVersionField(version);

0 commit comments

Comments
 (0)