Skip to content

Commit c6d3769

Browse files
committed
Merge remote-tracking branch 'upstream/main' into invalid-grok-500
* upstream/main: (58 commits) ESQL: mark LOOKUP JOIN as ExecutesOn.Any by default (elastic#133064) Fix 404s in REST API landing page (elastic#133086) Fix release tests for OptimizerVerificationTests (elastic#133100) Make Glob non-recursive (elastic#132798) Update ES|QL function list for release versions (elastic#133096) Split transport version func test into abstract base (elastic#133035) Omit project ID from snapshot metrics (elastic#133098) Mute org.elasticsearch.xpack.esql.analysis.AnalyzerTests testNoDenseVectorFailsForMagnitude elastic#133013 Mute org.elasticsearch.xpack.esql.optimizer.OptimizerVerificationTests testRemoteEnrichAfterCoordinatorOnlyPlans elastic#133015 Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/160_exists_query/Test exists query on _id field} elastic#133097 Rename initial to unreferenced in transport versions (elastic#133082) Rename exception type header (elastic#133045) ESQL: Pluggable tests for Operator status (elastic#132876) ESQL: Mark new signatures in MIN and MAX (elastic#132980) Don't try to serialize half-baked cluster info (elastic#132756) migrate ml_rollover_legacy_indices transport version (elastic#133008) Enable `exclude_source_vectors` by default for new indices (elastic#131907) Expose APIs needed by flush during translog replay (elastic#132960) Change reporting_user role to leverage reserved kibana privileges (elastic#132766) Update TasksIT for batched execution (elastic#132762) ...
2 parents becf24a + 5e43ea5 commit c6d3769

File tree

252 files changed

+5295
-1206
lines changed

Some content is hidden

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

252 files changed

+5295
-1206
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ testfixtures_shared/
6969
# Generated
7070
checkstyle_ide.xml
7171
x-pack/plugin/esql/src/main/generated-src/generated/
72-
server/src/main/resources/transport/defined/manifest.txt
72+
server/src/main/resources/transport/definitions/manifest.txt
7373

7474
# JEnv
7575
.java-version

BUILDING.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ uses the changed dependencies. In most cases, `precommit` or `check` are good ca
9292
We prefer sha256 checksums as md5 and sha1 are not considered safe anymore these days. The generated entry
9393
will have the `origin` attribute been set to `Generated by Gradle`.
9494

95-
> [!Tip]
95+
> [!Tip]
9696
> A manual confirmation of the Gradle generated checksums is currently not mandatory.
9797
> If you want to add a level of verification you can manually confirm the checksum (e.g. by looking it up on the website of the library)
9898
> Please replace the content of the `origin` attribute by `official site` in that case.
@@ -186,6 +186,25 @@ dependencies {
186186

187187
To test an unreleased development version of a third party dependency you have several options.
188188

189+
### How do I test against java early access (ea) versions?
190+
191+
Currently only openjdk EA builds by oracle are supported.
192+
To test against an early access version java version you can pass the major
193+
java version appended with `-ea` as a system property (e.g. -Druntime.java=26-ea) to the Gradle build:
194+
195+
```
196+
./gradlew clean test -Druntime.java=26-ea
197+
```
198+
199+
This will run the tests using the JDK 26 EA version and pick the latest available build of the matching JDK EA version we expose
200+
in our custom jdk catalogue at `https://storage.googleapis.com/elasticsearch-jdk-archive/jdks/openjdk/latest.json`.
201+
202+
To run against a specific build number of the EA build you can pass a second system property (e.g. `-Druntime.java.build=6`):
203+
204+
```
205+
./gradlew clean test -Druntime.java=26-ea -Druntime.java.build=6
206+
```
207+
189208
#### How to use a Maven based third party dependency via `mavenlocal`?
190209

191210
1. Clone the third party repository locally
@@ -229,7 +248,7 @@ In addition to snapshot builds JitPack supports building Pull Requests. Simply u
229248
3. Run the Gradle build as needed. Keep in mind the initial resolution might take a bit longer as this needs to be built
230249
by JitPack in the background before we can resolve the adhoc built dependency.
231250

232-
> [!Note]
251+
> [!Note]
233252
> You should only use that approach locally or on a developer branch for production dependencies as we do
234253
not want to ship unreleased libraries into our releases.
235254

@@ -261,7 +280,7 @@ allprojects {
261280
```
262281
4. Run the Gradle build as needed with `--write-verification-metadata` to ensure the Gradle dependency verification does not fail on your custom dependency.
263282

264-
> [!Note]
283+
> [!Note]
265284
> As Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated,
266285
flat directory repositories cannot be used to override artifacts with real meta-data from other repositories declared in the build.
267286
> For example, if Gradle finds only `jmxri-1.2.1.jar` in a flat directory repository, but `jmxri-1.2.1.pom` in another repository

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/QueryPlanningBenchmark.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public void setup() {
9292
var fields = 10_000;
9393
var mapping = LinkedHashMap.<String, EsField>newLinkedHashMap(fields);
9494
for (int i = 0; i < fields; i++) {
95-
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true));
95+
// We're creating a standard index, so none of these fields should be marked as dimensions.
96+
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true, EsField.TimeSeriesFieldType.NONE));
9697
}
9798

9899
var esIndex = new EsIndex("test", mapping, Map.of("test", IndexMode.STANDARD));

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
212212
FieldAttribute timestamp = new FieldAttribute(
213213
Source.EMPTY,
214214
"timestamp",
215-
new EsField("timestamp", DataType.DATETIME, Map.of(), true)
215+
new EsField("timestamp", DataType.DATETIME, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
216216
);
217217
yield EvalMapper.toEvaluator(
218218
FOLD_CONTEXT,
@@ -321,19 +321,35 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
321321
}
322322

323323
private static FieldAttribute longField() {
324-
return new FieldAttribute(Source.EMPTY, "long", new EsField("long", DataType.LONG, Map.of(), true));
324+
return new FieldAttribute(
325+
Source.EMPTY,
326+
"long",
327+
new EsField("long", DataType.LONG, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
328+
);
325329
}
326330

327331
private static FieldAttribute doubleField() {
328-
return new FieldAttribute(Source.EMPTY, "double", new EsField("double", DataType.DOUBLE, Map.of(), true));
332+
return new FieldAttribute(
333+
Source.EMPTY,
334+
"double",
335+
new EsField("double", DataType.DOUBLE, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
336+
);
329337
}
330338

331339
private static FieldAttribute intField() {
332-
return new FieldAttribute(Source.EMPTY, "int", new EsField("int", DataType.INTEGER, Map.of(), true));
340+
return new FieldAttribute(
341+
Source.EMPTY,
342+
"int",
343+
new EsField("int", DataType.INTEGER, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
344+
);
333345
}
334346

335347
private static FieldAttribute keywordField() {
336-
return new FieldAttribute(Source.EMPTY, "keyword", new EsField("keyword", DataType.KEYWORD, Map.of(), true));
348+
return new FieldAttribute(
349+
Source.EMPTY,
350+
"keyword",
351+
new EsField("keyword", DataType.KEYWORD, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
352+
);
337353
}
338354

339355
private static Configuration configuration() {

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGitAwareGradleFuncTest.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.gradle.fixtures
1111

1212
import org.apache.commons.io.FileUtils
13-
import org.elasticsearch.gradle.internal.test.InternalAwareGradleRunner
1413
import org.gradle.testkit.runner.GradleRunner
1514
import org.junit.Rule
1615
import org.junit.rules.TemporaryFolder

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/JdkDownloadPluginFuncTest.groovy

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
3333
private static final String ADOPT_JDK_VERSION_15 = "15.0.2+7"
3434
private static final String AZUL_JDK_VERSION_8 = "8u302+b08"
3535
private static final String AZUL_8_DISTRO_VERSION = "8.56.0.23"
36+
private static final String CATALOG_EA_VERSION = "25-ea+30"
3637
private static final String OPEN_JDK_VERSION = "12.0.1+99@123456789123456789123456789abcde"
3738
private static final Pattern JDK_HOME_LOGLINE = Pattern.compile("JDK HOME: (.*)")
3839

40+
def setup() {
41+
configurationCacheCompatible = false // JDK class references configurations which break configuration cache
42+
}
43+
3944
@Unroll
40-
def "jdk #jdkVendor for #platform#suffix are downloaded and extracted"() {
45+
def "jdk #distributionVersion #jdkVendor for #platform#suffix are downloaded and extracted"() {
4146
given:
42-
def mockRepoUrl = urlPath(jdkVendor, jdkVersion, platform, arch);
47+
def mockRepoUrl = urlPath(jdkVendor, jdkVersion, platform, arch, distributionVersion);
4348
def mockedContent = filebytes(jdkVendor, platform)
4449
buildFile.text = """
4550
plugins {
@@ -77,21 +82,26 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
7782

7883
where:
7984
platform | arch | jdkVendor | jdkVersion | distributionVersion | expectedJavaBin | suffix
80-
"linux" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | null | "bin/java" | ""
81-
"linux" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | null | "bin/java" | ""
82-
"linux" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | null | "bin/java" | "(old version)"
83-
"windows" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | null | "bin/java" | ""
84-
"windows" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | null | "bin/java" | ""
85-
"windows" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | null | "bin/java" | "(old version)"
86-
"darwin" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | null | "Contents/Home/bin/java" | ""
87-
"darwin" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | null | "Contents/Home/bin/java" | ""
88-
"darwin" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | null | "Contents/Home/bin/java" | "(old version)"
89-
"mac" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | null | "Contents/Home/bin/java" | ""
90-
"mac" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | null | "Contents/Home/bin/java" | "(old version)"
91-
"darwin" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | null | "Contents/Home/bin/java" | ""
92-
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | null | "bin/java" | ""
93-
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION_11 | null | "bin/java" | "(jdk 11)"
94-
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION_15 | null | "bin/java" | "(jdk 15)"
85+
"linux" | "aarch64" | VENDOR_OPENJDK | CATALOG_EA_VERSION | "ea" | "bin/java" | ""
86+
"linux" | "x64" | VENDOR_OPENJDK | CATALOG_EA_VERSION | "ea" | "bin/java" | ""
87+
"darwin" | "aarch64" | VENDOR_OPENJDK | CATALOG_EA_VERSION | "ea" | "Contents/Home/bin/java" | ""
88+
"darwin" | "x64" | VENDOR_OPENJDK | CATALOG_EA_VERSION | "ea" | "Contents/Home/bin/java" | ""
89+
"windows" | "x64" | VENDOR_OPENJDK | CATALOG_EA_VERSION | "ea" | "bin/java" | ""
90+
"linux" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | "" | "bin/java" | ""
91+
"linux" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | "" | "bin/java" | ""
92+
"linux" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | "" | "bin/java" | "(old version)"
93+
"windows" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | "" | "bin/java" | ""
94+
"windows" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | "" | "bin/java" | ""
95+
"windows" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | "" | "bin/java" | "(old version)"
96+
"darwin" | "x64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | "" | "Contents/Home/bin/java" | ""
97+
"darwin" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | "" | "Contents/Home/bin/java" | ""
98+
"darwin" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | "" | "Contents/Home/bin/java" | "(old version)"
99+
"mac" | "x64" | VENDOR_OPENJDK | OPEN_JDK_VERSION | "" | "Contents/Home/bin/java" | ""
100+
"mac" | "x64" | VENDOR_OPENJDK | OPENJDK_VERSION_OLD | "" | "Contents/Home/bin/java" | "(old version)"
101+
"darwin" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | "" | "Contents/Home/bin/java" | ""
102+
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION | "" | "bin/java" | ""
103+
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION_11 | "" | "bin/java" | "(jdk 11)"
104+
"linux" | "aarch64" | VENDOR_ADOPTIUM | ADOPT_JDK_VERSION_15 | "" | "bin/java" | "(jdk 15)"
95105
"darwin" | "aarch64" | VENDOR_ZULU | AZUL_JDK_VERSION_8 | AZUL_8_DISTRO_VERSION | "Contents/Home/bin/java" | "(jdk 8)"
96106
}
97107

@@ -214,13 +224,19 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
214224
private static String urlPath(final String vendor,
215225
final String version,
216226
final String platform,
217-
final String arch = 'x64') {
218-
if (vendor.equals(VENDOR_ADOPTIUM)) {
227+
final String arch = 'x64',
228+
final String distributedVersion = '') {
229+
final boolean isOld = version.equals(OPENJDK_VERSION_OLD);
230+
231+
if (distributedVersion.equals("ea")) {
232+
def effectivePlatform = isMac(platform) ? "macos" : platform;
233+
def fileExtension = platform.toLowerCase().equals("windows") ? "zip" : "tar.gz";
234+
return "/jdks/openjdk/25/openjdk-${version}/openjdk-${version}_$effectivePlatform-${arch}_bin.$fileExtension";
235+
} else if (vendor.equals(VENDOR_ADOPTIUM)) {
219236
final String module = isMac(platform) ? "mac" : platform;
220237
return "/jdk-" + version + "/" + module + "/${arch}/jdk/hotspot/normal/adoptium";
221238
} else if (vendor.equals(VENDOR_OPENJDK)) {
222239
final String effectivePlatform = isMac(platform) ? "macos" : platform;
223-
final boolean isOld = version.equals(OPENJDK_VERSION_OLD);
224240
final String versionPath = isOld ? "jdk1/99" : "jdk12.0.1/123456789123456789123456789abcde/99";
225241
final String filename = "openjdk-" + (isOld ? "1" : "12.0.1") + "_" + effectivePlatform + "-x64_bin." + extension(platform);
226242
return "/java/GA/" + versionPath + "/GPL/" + filename;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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.transport
11+
12+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
13+
import org.gradle.testkit.runner.BuildResult
14+
import org.gradle.testkit.runner.TaskOutcome
15+
16+
class AbstractTransportVersionFuncTest extends AbstractGradleFuncTest {
17+
def javaResource(String project, String path, String content) {
18+
file("${project}/src/main/resources/${path}").withWriter { writer ->
19+
writer << content
20+
}
21+
}
22+
23+
def javaSource(String project, String packageName, String className, String imports, String content) {
24+
String packageSlashes = packageName.replace('.', '/')
25+
file("${project}/src/main/java/${packageSlashes}/${className}.java").withWriter { writer ->
26+
writer << """
27+
package ${packageName};
28+
${imports}
29+
public class ${className} {
30+
${content}
31+
}
32+
"""
33+
}
34+
}
35+
36+
def namedTransportVersion(String name, String ids) {
37+
javaResource("myserver", "transport/definitions/named/" + name + ".csv", ids)
38+
}
39+
40+
def unreferencedTransportVersion(String name, String id) {
41+
javaResource("myserver", "transport/definitions/unreferenced/" + name + ".csv", id)
42+
}
43+
44+
def definedAndUsedTransportVersion(String name, String ids) {
45+
return definedAndUsedTransportVersion(name, ids, "Test${name.capitalize()}")
46+
}
47+
48+
def definedAndUsedTransportVersion(String name, String ids, String classname) {
49+
javaSource("myserver", "org.elasticsearch", classname, "", """
50+
static final TransportVersion usage = TransportVersion.fromName("${name}");
51+
""")
52+
namedTransportVersion(name, ids)
53+
}
54+
55+
def latestTransportVersion(String branch, String name, String id) {
56+
javaResource("myserver", "transport/latest/" + branch + ".csv","${name},${id}")
57+
}
58+
59+
def validateReferencesFails(String project) {
60+
return gradleRunner(":${project}:validateTransportVersionReferences").buildAndFail()
61+
}
62+
63+
def validateDefinitionsFails() {
64+
return gradleRunner(":myserver:validateTransportVersionDefinitions").buildAndFail()
65+
}
66+
67+
def assertReferencesFailure(BuildResult result, String project, String expectedOutput) {
68+
result.task(":${project}:validateTransportVersionReferences").outcome == TaskOutcome.FAILED
69+
assertOutputContains(result.output, expectedOutput)
70+
}
71+
72+
def assertDefinitionsFailure(BuildResult result, String expectedOutput) {
73+
result.task(":myserver:validateTransportVersionDefinitions").outcome == TaskOutcome.FAILED
74+
assertOutputContains(result.output, expectedOutput)
75+
}
76+
77+
def setup() {
78+
configurationCacheCompatible = false
79+
internalBuild()
80+
settingsFile << """
81+
include ':myserver'
82+
include ':myplugin'
83+
"""
84+
file("gradle.properties") << """
85+
org.elasticsearch.transport.definitionsProject=:myserver
86+
"""
87+
88+
file("myserver/build.gradle") << """
89+
apply plugin: 'java-library'
90+
apply plugin: 'elasticsearch.transport-version-references'
91+
apply plugin: 'elasticsearch.transport-version-resources'
92+
"""
93+
namedTransportVersion("existing_91", "8012000")
94+
namedTransportVersion("existing_92", "8123000,8012001")
95+
unreferencedTransportVersion("initial_9_0_0", "8000000")
96+
latestTransportVersion("9.2", "existing_92", "8123000")
97+
latestTransportVersion("9.1", "existing_92", "8012001")
98+
// a mock version of TransportVersion, just here so we can compile Dummy.java et al
99+
javaSource("myserver", "org.elasticsearch", "TransportVersion", "", """
100+
public static TransportVersion fromName(String name) {
101+
return null;
102+
}
103+
""")
104+
javaSource("myserver", "org.elasticsearch", "Dummy", "", """
105+
static final TransportVersion existing91 = TransportVersion.fromName("existing_91");
106+
static final TransportVersion existing92 = TransportVersion.fromName("existing_92");
107+
""")
108+
109+
file("myplugin/build.gradle") << """
110+
apply plugin: 'java-library'
111+
apply plugin: 'elasticsearch.transport-version-references'
112+
113+
dependencies {
114+
implementation project(":myserver")
115+
}
116+
"""
117+
118+
setupLocalGitRepo()
119+
execute("git checkout -b main")
120+
execute("git checkout -b test")
121+
}
122+
}

0 commit comments

Comments
 (0)