Skip to content

Commit e9f1126

Browse files
Merge branch 'main' into esql/fix_query_log_npe
2 parents 67d1666 + 92ccd73 commit e9f1126

File tree

1,543 files changed

+15396
-3534
lines changed

Some content is hidden

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

1,543 files changed

+15396
-3534
lines changed

.buildkite/pipelines/periodic-packaging.template.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ steps:
1212
- opensuse-leap-15
1313
- oraclelinux-8
1414
- oraclelinux-9
15+
- orcalelinux-10
1516
- sles-15
1617
- ubuntu-2204
1718
- ubuntu-2404
1819
- rocky-8
1920
- rocky-9
21+
- rocky-10
2022
- rhel-8
2123
- rhel-9
2224
- rhel-10
2325
- almalinux-8
2426
- almalinux-9
27+
- almalinux-10
2528
agents:
2629
provider: gcp
2730
image: family/elasticsearch-{{matrix.image}}

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ steps:
1313
- opensuse-leap-15
1414
- oraclelinux-8
1515
- oraclelinux-9
16+
- orcalelinux-10
1617
- sles-15
1718
- ubuntu-2204
1819
- ubuntu-2404
1920
- rocky-8
2021
- rocky-9
22+
- rocky-10
2123
- rhel-8
2224
- rhel-9
2325
- rhel-10
2426
- almalinux-8
2527
- almalinux-9
28+
- almalinux-10
2629
agents:
2730
provider: gcp
2831
image: family/elasticsearch-{{matrix.image}}

.buildkite/pipelines/periodic-platform-support.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ steps:
1414
- opensuse-leap-15
1515
- oraclelinux-8
1616
- oraclelinux-9
17+
- oraclelinux-10
1718
- sles-15
1819
- ubuntu-2204
1920
- ubuntu-2404
2021
- rocky-8
2122
- rocky-9
23+
- rocky-10
2224
- rhel-8
2325
- rhel-9
2426
- rhel-10
2527
- almalinux-8
2628
- almalinux-9
29+
- almalinux-10
2730
agents:
2831
provider: gcp
2932
image: family/elasticsearch-{{matrix.image}}

.buildkite/pipelines/pull-request/packaging-tests-unix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ steps:
1515
- opensuse-leap-15
1616
- oraclelinux-8
1717
- oraclelinux-9
18+
- oraclelinux-10
1819
- sles-15
1920
- ubuntu-2204
2021
- ubuntu-2404
2122
- rocky-8
2223
- rocky-9
24+
- rocky-10
2325
- rhel-8
2426
- rhel-9
2527
- rhel-10
2628
- almalinux-8
2729
- almalinux-9
30+
- almalinux-10
2831
PACKAGING_TASK:
2932
- docker
3033
- docker-cloud-ess

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The repository is organized into several key directories:
9090
- Prefer Gradle tasks over ad-hoc scripts.
9191
- When scripting CLI sequences, leverage `gradlew` task.
9292
- Unrecognized changes: assume other agent; keep going; focus your changes. If it causes issues, stop + ask user.
93-
- Do not add "Co-Authored-By" lines to commit messages. commit messages should adhere to the 50/72 rule: use a maximum of 50 columns for the commit summary
93+
- Do not add "Co-Authored-By" or any AI attribution trailers to commit messages, by any means—including `--trailer`, `-m`, or any other git flag. commit messages should adhere to the 50/72 rule: use a maximum of 50 columns for the commit summary
9494

9595
## Backwards compatibility
9696
- For changes to a `Writeable` implementation (`writeTo` and constructor from `StreamInput`), add a new `public static final <UNIQUE_DESCRIPTIVE_NAME> = TransportVersion.fromName("<unique_descriptive_name>")` and use it in the new code paths. Confirm the backport branches and then generate a new version file with `./gradlew generateTransportVersion`.

benchmarks/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dependencies {
4747
api(project(':x-pack:plugin:core'))
4848
api(project(':x-pack:plugin:esql'))
4949
api(project(':x-pack:plugin:esql:compute'))
50-
api(project(':x-pack:plugin:mapper-exponential-histogram'))
50+
api(project(':x-pack:plugin:analytics'))
5151
api(project(':x-pack:plugin:logsdb'))
5252
implementation project(path: ':libs:native')
5353
implementation project(path: ':libs:simdvec')

benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/DynamicMapperBenchmark.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
import org.elasticsearch.common.UUIDs;
1313
import org.elasticsearch.common.bytes.BytesArray;
14-
import org.elasticsearch.common.compress.CompressedXContent;
15-
import org.elasticsearch.common.xcontent.XContentHelper;
1614
import org.elasticsearch.index.mapper.DocumentMapper;
1715
import org.elasticsearch.index.mapper.LuceneDocument;
1816
import org.elasticsearch.index.mapper.MapperService;
@@ -185,21 +183,16 @@ public List<LuceneDocument> benchmarkDynamicallyCreatedFields() throws Exception
185183
MapperService mapperService = MapperServiceFactory.create("{}");
186184
for (int i = 0; i < 25; i++) {
187185
DocumentMapper documentMapper = mapperService.documentMapper();
188-
Mapping mapping = null;
189-
if (documentMapper == null) {
186+
boolean noMappings = documentMapper == null;
187+
if (noMappings) {
190188
documentMapper = DocumentMapper.createEmpty(mapperService);
191-
mapping = documentMapper.mapping();
192189
}
193190
ParsedDocument doc = documentMapper.parse(randomFrom(sources));
194-
if (mapping != null) {
195-
doc.addDynamicMappingsUpdate(mapping);
191+
if (noMappings) {
192+
doc.addDynamicMappingsUpdate(Mapping.emptyCompressed());
196193
}
197194
if (doc.dynamicMappingsUpdate() != null) {
198-
mapperService.merge(
199-
"_doc",
200-
new CompressedXContent(XContentHelper.toXContent(doc.dynamicMappingsUpdate(), XContentType.JSON, false)),
201-
MapperService.MergeReason.MAPPING_UPDATE
202-
);
195+
mapperService.merge("_doc", doc.dynamicMappingsUpdate(), MapperService.MergeReason.MAPPING_UPDATE);
203196
}
204197
}
205198
return mapperService.documentMapper().parse(randomFrom(sources)).docs();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.gradle.internal.info
11+
12+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
13+
import org.gradle.testkit.runner.TaskOutcome
14+
15+
class GlobalBuildInfoPluginOfflineBranchesFallbackFuncTest extends AbstractGradleFuncTest {
16+
17+
def setup() {
18+
// This plugin reads files from the workspace and performs environment detection
19+
// that is not compatible with the configuration cache in functional tests.
20+
configurationCacheCompatible = false
21+
}
22+
23+
def "offline mode falls back to local branches.json when present"() {
24+
given:
25+
writeBwcVersionSource()
26+
writeBranchesJson()
27+
writeBuildThatResolvesBwcVersions()
28+
29+
when:
30+
def result = gradleRunner(
31+
"resolveBwcVersions",
32+
"--offline",
33+
// Make any accidental outbound HTTPS attempt fail deterministically.
34+
"-Dhttps.proxyHost=127.0.0.1",
35+
"-Dhttps.proxyPort=1",
36+
"-Dhttp.proxyHost=127.0.0.1",
37+
"-Dhttp.proxyPort=1",
38+
"-DBWC_VERSION_SOURCE=${file("Version.java").absolutePath}"
39+
).build()
40+
41+
then:
42+
result.task(":resolveBwcVersions").outcome == TaskOutcome.SUCCESS
43+
assertOutputContains(
44+
result.output,
45+
"Gradle is running in offline mode; falling back to local branches.json"
46+
)
47+
assertOutputContains(result.output, "BWC_VERSIONS_RESOLVED")
48+
}
49+
50+
def "offline mode without local branches.json retains failure behavior"() {
51+
given:
52+
writeBwcVersionSource()
53+
// Intentionally do not create branches.json
54+
writeBuildThatResolvesBwcVersions()
55+
56+
when:
57+
def result = gradleRunner(
58+
"resolveBwcVersions",
59+
"--offline",
60+
"-Dhttps.proxyHost=127.0.0.1",
61+
"-Dhttps.proxyPort=1",
62+
"-Dhttp.proxyHost=127.0.0.1",
63+
"-Dhttp.proxyPort=1",
64+
"-DBWC_VERSION_SOURCE=${file("Version.java").absolutePath}"
65+
).buildAndFail()
66+
67+
then:
68+
assertOutputContains(result.output, "Failed to download branches.json from:")
69+
assertOutputMissing(result.output, "falling back to local branches.json")
70+
}
71+
72+
def "non-offline mode does not fall back to local branches.json"() {
73+
given:
74+
writeBwcVersionSource()
75+
writeBranchesJson()
76+
writeBuildThatResolvesBwcVersions()
77+
78+
when:
79+
def result = gradleRunner(
80+
"resolveBwcVersions",
81+
// Not passing --offline on purpose.
82+
"-Dhttps.proxyHost=127.0.0.1",
83+
"-Dhttps.proxyPort=1",
84+
"-Dhttp.proxyHost=127.0.0.1",
85+
"-Dhttp.proxyPort=1",
86+
"-DBWC_VERSION_SOURCE=${file("Version.java").absolutePath}"
87+
).buildAndFail()
88+
89+
then:
90+
assertOutputContains(result.output, "Failed to download branches.json from:")
91+
assertOutputMissing(result.output, "falling back to local branches.json")
92+
}
93+
94+
private void writeBuildThatResolvesBwcVersions() {
95+
buildFile.text = """
96+
plugins {
97+
id 'elasticsearch.global-build-info'
98+
}
99+
100+
tasks.register("resolveBwcVersions") {
101+
doLast {
102+
// Force bwcVersions resolution, which triggers branches.json loading.
103+
def bwcVersions = buildParams.bwcVersionsProvider.get()
104+
println "BWC_VERSIONS_RESOLVED=[" + bwcVersions + "]"
105+
}
106+
}
107+
"""
108+
}
109+
110+
private void writeBranchesJson() {
111+
file("branches.json").text = """\
112+
{
113+
"branches": [
114+
{ "branch": "main", "version": "9.1.0" },
115+
{ "branch": "9.0", "version": "9.0.0" }
116+
]
117+
}
118+
""".stripIndent()
119+
}
120+
121+
private void writeBwcVersionSource() {
122+
// This file is parsed via regex; version constants must have a non-word
123+
// character before `public` and must end with `);` to match the pattern.
124+
file("Version.java").text = """\
125+
package org.elasticsearch;
126+
127+
public class Version {
128+
// Only used by GlobalBuildInfoPlugin in tests via regex parsing.
129+
public static final Version V_9_0_0 = Version.fromId(9000000);
130+
public static final Version V_9_1_0 = Version.fromId(9010000);
131+
132+
private static Version fromId(int id) {
133+
return new Version();
134+
}
135+
}
136+
"""
137+
}
138+
}
139+

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,24 @@ private List<Version> parseVersionLines(List<String> versionLines) {
214214
}
215215

216216
private List<DevelopmentBranch> getDevelopmentBranches() {
217-
String branchesFileLocation = project.getProviders()
218-
.gradleProperty(BRANCHES_FILE_LOCATION_PROPERTY)
219-
.getOrElse(DEFAULT_BRANCHES_FILE_URL);
217+
Provider<String> branchesFileLocationProperty = project.getProviders().gradleProperty(BRANCHES_FILE_LOCATION_PROPERTY);
218+
boolean hasExplicitBranchesFileLocation = branchesFileLocationProperty.isPresent();
219+
String branchesFileLocation = hasExplicitBranchesFileLocation ? branchesFileLocationProperty.get() : DEFAULT_BRANCHES_FILE_URL;
220+
if (hasExplicitBranchesFileLocation == false
221+
&& project.getGradle().getStartParameter().isOffline()
222+
&& branchesFileLocation.startsWith("http")) {
223+
File localBranchesFile = new File(Util.locateElasticsearchWorkspace(project.getGradle()), "branches.json");
224+
if (localBranchesFile.isFile()) {
225+
LOGGER.warn(
226+
"Gradle is running in offline mode; falling back to local branches.json at [{}] instead of downloading from [{}]. "
227+
+ "To override, set Gradle property [{}].",
228+
localBranchesFile.getAbsolutePath(),
229+
branchesFileLocation,
230+
BRANCHES_FILE_LOCATION_PROPERTY
231+
);
232+
branchesFileLocation = localBranchesFile.getAbsolutePath();
233+
}
234+
}
220235
LOGGER.info("Reading branches.json from {}", branchesFileLocation);
221236
byte[] branchesBytes;
222237
if (branchesFileLocation.startsWith("http")) {

build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/EmptyDirTaskTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
import java.io.File;
1717
import java.io.IOException;
18+
import java.nio.file.Files;
19+
import java.nio.file.attribute.PosixFilePermission;
20+
import java.util.Collections;
21+
import java.util.Set;
1822

1923
import static org.junit.Assert.assertEquals;
2024
import static org.junit.Assert.assertFalse;
@@ -61,9 +65,8 @@ public void testCreateEmptyDirNoPermissions() throws Exception {
6165

6266
assertTrue(newEmptyFolder.exists());
6367
assertTrue(newEmptyFolder.isDirectory());
64-
assertFalse(newEmptyFolder.canExecute());
65-
assertFalse(newEmptyFolder.canRead());
66-
assertFalse(newEmptyFolder.canWrite());
68+
Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(newEmptyFolder.toPath());
69+
assertEquals(Collections.emptySet(), permissions);
6770

6871
// cleanup
6972
newEmptyFolder.delete();

0 commit comments

Comments
 (0)