Skip to content

Commit 5aa3e95

Browse files
authored
Merge branch 'main' into clean-ali-inference-code
2 parents 16b65b5 + b2f290f commit 5aa3e95

File tree

545 files changed

+16600
-7628
lines changed

Some content is hidden

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

545 files changed

+16600
-7628
lines changed

build-tools-internal/src/main/groovy/elasticsearch.ide.gradle

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.elasticsearch.gradle.util.Pair
1111
import org.elasticsearch.gradle.util.GradleUtils
1212
import org.elasticsearch.gradle.internal.test.TestUtil
13+
import org.elasticsearch.gradle.internal.idea.EnablePreviewFeaturesTask
14+
import org.elasticsearch.gradle.internal.idea.IdeaXmlUtil
1315
import org.jetbrains.gradle.ext.JUnit
1416

1517
import java.nio.file.Files
@@ -144,19 +146,10 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
144146
}
145147

146148
// modifies the idea module config to enable preview features on ':libs:native' module
147-
tasks.register("enablePreviewFeatures") {
149+
tasks.register("enablePreviewFeatures", EnablePreviewFeaturesTask) {
148150
group = 'ide'
149151
description = 'Enables preview features on native library module'
150152
dependsOn tasks.named("enableExternalConfiguration")
151-
152-
// ext {
153-
def enablePreview = { moduleFile, languageLevel ->
154-
IdeaXmlUtil.modifyXml(moduleFile) { xml ->
155-
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = languageLevel
156-
}
157-
}
158-
// }
159-
160153
doLast {
161154
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.main.iml', 'JDK_21_PREVIEW')
162155
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.test.iml', 'JDK_21_PREVIEW')
@@ -277,46 +270,6 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
277270
}
278271
}
279272

280-
/**
281-
* Parses a given XML file, applies a set of changes, and writes those changes back to the original file.
282-
*
283-
* @param path Path to existing XML file
284-
* @param action Action to perform on parsed XML document
285-
* @param preface optional front matter to add after the XML declaration
286-
* but before the XML document, e.g. a doctype or comment
287-
*/
288-
289-
class IdeaXmlUtil {
290-
static Node parseXml(Object xmlPath) {
291-
File xmlFile = new File(xmlPath)
292-
XmlParser xmlParser = new XmlParser(false, true, true)
293-
xmlParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
294-
Node xml = xmlParser.parse(xmlFile)
295-
return xml
296-
}
297-
298-
static void modifyXml(Object xmlPath, Action<? super Node> action, String preface = null) {
299-
File xmlFile = new File(xmlPath)
300-
if (xmlFile.exists()) {
301-
Node xml = parseXml(xmlPath)
302-
action.execute(xml)
303-
304-
xmlFile.withPrintWriter { writer ->
305-
def printer = new XmlNodePrinter(writer)
306-
printer.namespaceAware = true
307-
printer.preserveWhitespace = true
308-
writer.write("<?xml version=\"1.0\"?>\n")
309-
310-
if (preface != null) {
311-
writer.write(preface)
312-
}
313-
printer.print(xml)
314-
}
315-
}
316-
}
317-
}
318-
319-
320273
Pair<File, IncludedBuild> locateElasticsearchWorkspace(Gradle gradle) {
321274
if (gradle.parent == null) {
322275
// See if any of these included builds is the Elasticsearch gradle
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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.idea;
11+
12+
import groovy.util.Node;
13+
import groovy.util.NodeList;
14+
15+
import org.gradle.api.DefaultTask;
16+
import org.xml.sax.SAXException;
17+
18+
import java.io.IOException;
19+
20+
import javax.xml.parsers.ParserConfigurationException;
21+
22+
public class EnablePreviewFeaturesTask extends DefaultTask {
23+
24+
public void enablePreview(String moduleFile, String languageLevel) throws IOException, ParserConfigurationException, SAXException {
25+
IdeaXmlUtil.modifyXml(moduleFile, xml -> {
26+
// Find the 'component' node
27+
NodeList nodes = (NodeList) xml.depthFirst();
28+
Node componentNode = null;
29+
for (Object node : nodes) {
30+
Node currentNode = (Node) node;
31+
if ("component".equals(currentNode.name()) && "NewModuleRootManager".equals(currentNode.attribute("name"))) {
32+
componentNode = currentNode;
33+
break;
34+
}
35+
}
36+
37+
// Add the attribute to the 'component' node
38+
if (componentNode != null) {
39+
componentNode.attributes().put("LANGUAGE_LEVEL", languageLevel);
40+
}
41+
});
42+
}
43+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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.idea;
11+
12+
import groovy.util.Node;
13+
import groovy.util.XmlParser;
14+
import groovy.xml.XmlNodePrinter;
15+
16+
import org.gradle.api.Action;
17+
import org.xml.sax.SAXException;
18+
19+
import java.io.File;
20+
import java.io.IOException;
21+
import java.io.PrintWriter;
22+
23+
import javax.xml.parsers.ParserConfigurationException;
24+
25+
public class IdeaXmlUtil {
26+
27+
static Node parseXml(String xmlPath) throws IOException, SAXException, ParserConfigurationException {
28+
File xmlFile = new File(xmlPath);
29+
XmlParser xmlParser = new XmlParser(false, true, true);
30+
xmlParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
31+
Node xml = xmlParser.parse(xmlFile);
32+
return xml;
33+
}
34+
35+
/**
36+
* Parses a given XML file, applies a set of changes, and writes those changes back to the original file.
37+
*
38+
* @param path Path to existing XML file
39+
* @param action Action to perform on parsed XML document
40+
* but before the XML document, e.g. a doctype or comment
41+
*/
42+
static void modifyXml(String xmlPath, Action<? super Node> action) throws IOException, ParserConfigurationException, SAXException {
43+
modifyXml(xmlPath, action, null);
44+
}
45+
46+
/**
47+
* Parses a given XML file, applies a set of changes, and writes those changes back to the original file.
48+
*
49+
* @param path Path to existing XML file
50+
* @param action Action to perform on parsed XML document
51+
* @param preface optional front matter to add after the XML declaration
52+
* but before the XML document, e.g. a doctype or comment
53+
*/
54+
static void modifyXml(String xmlPath, Action<? super Node> action, String preface) throws IOException, ParserConfigurationException,
55+
SAXException {
56+
File xmlFile = new File(xmlPath);
57+
if (xmlFile.exists()) {
58+
Node xml = parseXml(xmlPath);
59+
action.execute(xml);
60+
61+
try (PrintWriter writer = new PrintWriter(xmlFile)) {
62+
var printer = new XmlNodePrinter(writer);
63+
printer.setNamespaceAware(true);
64+
printer.setPreserveWhitespace(true);
65+
writer.write("<?xml version=\"1.0\"?>\n");
66+
if (preface != null) {
67+
writer.write(preface);
68+
}
69+
printer.print(xml);
70+
}
71+
}
72+
}
73+
}

client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderIntegTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,22 @@ public static void stopHttpServers() throws IOException {
8989
}
9090

9191
public void testBuilderUsesDefaultSSLContext() throws Exception {
92-
assumeFalse("https://github.com/elastic/elasticsearch/issues/49094", inFipsJvm());
9392
final SSLContext defaultSSLContext = SSLContext.getDefault();
9493
try {
9594
try (RestClient client = buildRestClient()) {
9695
try {
9796
client.performRequest(new Request("GET", "/"));
9897
fail("connection should have been rejected due to SSL handshake");
9998
} catch (Exception e) {
100-
assertThat(e, instanceOf(SSLHandshakeException.class));
99+
if (inFipsJvm()) {
100+
// Bouncy Castle throw a different exception
101+
assertThat(e, instanceOf(IOException.class));
102+
assertThat(e.getCause(), instanceOf(javax.net.ssl.SSLException.class));
103+
} else {
104+
assertThat(e, instanceOf(SSLHandshakeException.class));
105+
}
101106
}
102107
}
103-
104108
SSLContext.setDefault(getSslContext());
105109
try (RestClient client = buildRestClient()) {
106110
Response response = client.performRequest(new Request("GET", "/"));
@@ -112,7 +116,6 @@ public void testBuilderUsesDefaultSSLContext() throws Exception {
112116
}
113117

114118
public void testBuilderSetsThreadName() throws Exception {
115-
assumeFalse("https://github.com/elastic/elasticsearch/issues/49094", inFipsJvm());
116119
final SSLContext defaultSSLContext = SSLContext.getDefault();
117120
try {
118121
SSLContext.setDefault(getSslContext());

distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/SystemJvmOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static List<String> systemJvmOptions(Settings nodeSettings, final Map<String, St
7171
maybeSetActiveProcessorCount(nodeSettings),
7272
maybeSetReplayFile(distroType, isHotspot),
7373
maybeWorkaroundG1Bug(),
74-
maybeAllowSecurityManager(),
74+
maybeAllowSecurityManager(useEntitlements),
7575
maybeAttachEntitlementAgent(useEntitlements)
7676
).flatMap(s -> s).toList();
7777
}
@@ -140,7 +140,7 @@ private static Stream<String> maybeWorkaroundG1Bug() {
140140
}
141141

142142
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
143-
private static Stream<String> maybeAllowSecurityManager() {
143+
private static Stream<String> maybeAllowSecurityManager(boolean useEntitlements) {
144144
if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
145145
// Will become conditional on useEntitlements once entitlements can run without SM
146146
return Stream.of("-Djava.security.manager=allow");

docs/changelog/118324.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 118324
2+
summary: Allow the data type of `null` in filters
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 116351

docs/changelog/118652.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118652
2+
summary: Add Jina AI API to do inference for Embedding and Rerank models
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/118871.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118871
2+
summary: "[Elastic Inference Service] Add ElasticInferenceService Unified ChatCompletions Integration"
3+
area: Inference
4+
type: enhancement
5+
issues: []

docs/changelog/118919.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118919
2+
summary: Remove unsupported timeout from rest-api-spec license API
3+
area: License
4+
type: bug
5+
issues: []

docs/changelog/118921.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118921
2+
summary: Add missing timeouts to rest-api-spec shutdown APIs
3+
area: Infra/Node Lifecycle
4+
type: bug
5+
issues: []

0 commit comments

Comments
 (0)