Skip to content

Commit ff8a3a1

Browse files
authored
Merge branch 'main' into resolve-index-mode-filter
2 parents 92df4ab + 19c035f commit ff8a3a1

File tree

78 files changed

+3098
-1064
lines changed

Some content is hidden

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

78 files changed

+3098
-1064
lines changed

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -330,24 +330,22 @@ private static void configureEntitlements(Project project) {
330330
.matching(test -> TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()))
331331
.configureEach(test -> {
332332
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
333+
SystemPropertyCommandLineArgumentProvider nonInputSystemProperties = test.getExtensions()
334+
.getByType(SystemPropertyCommandLineArgumentProvider.class);
333335

334336
// Agent
335-
if (agentFiles.isEmpty() == false) {
336-
test.getInputs().files(agentFiles);
337-
test.systemProperty("es.entitlement.agentJar", agentFiles.getAsPath());
338-
test.systemProperty("jdk.attach.allowAttachSelf", true);
339-
}
337+
test.getInputs().files(agentFiles).optional(true);
338+
nonInputSystemProperties.systemProperty("es.entitlement.agentJar", agentFiles::getAsPath);
339+
nonInputSystemProperties.systemProperty("jdk.attach.allowAttachSelf", () -> agentFiles.isEmpty() ? "false" : "true");
340340

341341
// Bridge
342-
if (bridgeFiles.isEmpty() == false) {
343-
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
344-
test.getInputs().files(bridgeFiles);
345-
// Tests may not be modular, but the JDK still is
346-
test.jvmArgs(
347-
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
348-
+ modulesContainingEntitlementInstrumentation
349-
);
350-
}
342+
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
343+
test.getInputs().files(bridgeFiles).optional(true);
344+
// Tests may not be modular, but the JDK still is
345+
test.jvmArgs(
346+
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
347+
+ modulesContainingEntitlementInstrumentation
348+
);
351349
});
352350
}
353351

docs/changelog/133424.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133424
2+
summary: Ensuring only a single request executor object is created
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/changelog/133604.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133604
2+
summary: Update `DefBootstrap` to handle Error from `ClassValue`
3+
area: Infra/Scripting
4+
type: bug
5+
issues: []

docs/changelog/133611.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 133611
2+
summary: Allow trailing empty string field names in paths of flattened field
3+
area: Mapping
4+
type: bug
5+
issues:
6+
- 130139

gradle/verification-metadata.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,16 @@
17511751
<sha256 value="2eaaac5f268b135f0e11dd30637d71df5751a0bb7ed6268659be57104d63122b" origin="Generated by Gradle"/>
17521752
</artifact>
17531753
</component>
1754+
<component group="io.opentelemetry" name="opentelemetry-api" version="1.53.0">
1755+
<artifact name="opentelemetry-api-1.53.0.jar">
1756+
<sha256 value="1991903b9fc76b27f1e6a70a5a97131668fb5f3ac9026178c450d510cbb1bef2" origin="Generated by Gradle"/>
1757+
</artifact>
1758+
</component>
1759+
<component group="io.opentelemetry" name="opentelemetry-common" version="1.53.0">
1760+
<artifact name="opentelemetry-common-1.53.0.jar">
1761+
<sha256 value="73a5181dd07e72c4312fadafc8328ad1046a32c050030e3a7b8c16113daad359" origin="Generated by Gradle"/>
1762+
</artifact>
1763+
</component>
17541764
<component group="io.opentelemetry" name="opentelemetry-context" version="1.31.0">
17551765
<artifact name="opentelemetry-context-1.31.0.jar">
17561766
<sha256 value="664896a5c34bcda20c95c8f45198a95e8f97a1cd5e5c2923978f42dddada787d" origin="Generated by Gradle"/>
@@ -1766,11 +1776,61 @@
17661776
<sha256 value="76f9dfe1a6f74d5081e07bde1f7cb9a06879d317ec0ae0f61dd8fb2be9afad4f" origin="Generated by Gradle"/>
17671777
</artifact>
17681778
</component>
1779+
<component group="io.opentelemetry" name="opentelemetry-context" version="1.53.0">
1780+
<artifact name="opentelemetry-context-1.53.0.jar">
1781+
<sha256 value="88a780c5bb7b51e7c07071d61403e34f13277d092bf441a5cb49cf2ce9c756e9" origin="Generated by Gradle"/>
1782+
</artifact>
1783+
</component>
1784+
<component group="io.opentelemetry" name="opentelemetry-exporter-common" version="1.53.0">
1785+
<artifact name="opentelemetry-exporter-common-1.53.0.jar">
1786+
<sha256 value="d7f093f987547c9c2c2caa28baf1254507c59b4dbf97b49fee5c9cd1ceb6f8d5" origin="Generated by Gradle"/>
1787+
</artifact>
1788+
</component>
1789+
<component group="io.opentelemetry" name="opentelemetry-exporter-otlp" version="1.53.0">
1790+
<artifact name="opentelemetry-exporter-otlp-1.53.0.jar">
1791+
<sha256 value="0ce88bf35577894ee185f718f1b981938bbfc8981f3b7fcecbfd7b7c375bc236" origin="Generated by Gradle"/>
1792+
</artifact>
1793+
</component>
1794+
<component group="io.opentelemetry" name="opentelemetry-exporter-otlp-common" version="1.53.0">
1795+
<artifact name="opentelemetry-exporter-otlp-common-1.53.0.jar">
1796+
<sha256 value="32bcf0e855110b09cffbb5aac59c69d2caaa35de646e07c0a5f7f50ab42d4c1f" origin="Generated by Gradle"/>
1797+
</artifact>
1798+
</component>
1799+
<component group="io.opentelemetry" name="opentelemetry-exporter-sender-jdk" version="1.53.0">
1800+
<artifact name="opentelemetry-exporter-sender-jdk-1.53.0.jar">
1801+
<sha256 value="d147fd99aa23be8b0ea8acbc06ffae2f091af2edfffeb44163ab79765f7e3b42" origin="Generated by Gradle"/>
1802+
</artifact>
1803+
</component>
17691804
<component group="io.opentelemetry" name="opentelemetry-sdk" version="1.47.0">
17701805
<artifact name="opentelemetry-sdk-1.47.0.jar">
17711806
<sha256 value="4a09eb2ee484769973e14218a34e6da54f35955aa02b26dc5238b0c2ed6a801d" origin="Generated by Gradle"/>
17721807
</artifact>
17731808
</component>
1809+
<component group="io.opentelemetry" name="opentelemetry-sdk" version="1.53.0">
1810+
<artifact name="opentelemetry-sdk-1.53.0.jar">
1811+
<sha256 value="d58721063bca5d612bf1f6dccb883664210999c5aa470c149d1509672f13229c" origin="Generated by Gradle"/>
1812+
</artifact>
1813+
</component>
1814+
<component group="io.opentelemetry" name="opentelemetry-sdk-common" version="1.53.0">
1815+
<artifact name="opentelemetry-sdk-common-1.53.0.jar">
1816+
<sha256 value="a5d68aca0920aa0dc17b9ecc5510abe4c344e66eae9a4420c992298e4712d3bc" origin="Generated by Gradle"/>
1817+
</artifact>
1818+
</component>
1819+
<component group="io.opentelemetry" name="opentelemetry-sdk-extension-autoconfigure" version="1.53.0">
1820+
<artifact name="opentelemetry-sdk-extension-autoconfigure-1.53.0.jar">
1821+
<sha256 value="72becaccfb3d79d91c6486bf4e68f2474a1aa7742934fb675ea077e35a8dc3e1" origin="Generated by Gradle"/>
1822+
</artifact>
1823+
</component>
1824+
<component group="io.opentelemetry" name="opentelemetry-sdk-extension-autoconfigure-spi" version="1.53.0">
1825+
<artifact name="opentelemetry-sdk-extension-autoconfigure-spi-1.53.0.jar">
1826+
<sha256 value="e814e63dc2f8cbdf84574b6289eb543b89b06486d03cad1e697b06d802ce27bb" origin="Generated by Gradle"/>
1827+
</artifact>
1828+
</component>
1829+
<component group="io.opentelemetry" name="opentelemetry-sdk-metrics" version="1.53.0">
1830+
<artifact name="opentelemetry-sdk-metrics-1.53.0.jar">
1831+
<sha256 value="3d7dbae6c03be035e7c4dbdd50442741b260be5463fa9aadca1b00af0efddee5" origin="Generated by Gradle"/>
1832+
</artifact>
1833+
</component>
17741834
<component group="io.opentelemetry" name="opentelemetry-semconv" version="1.21.0-alpha">
17751835
<artifact name="opentelemetry-semconv-1.21.0-alpha.jar">
17761836
<sha256 value="4a8f41b93eec51e85fa6b48e43de6785b742316fdd9c9baf595adbce6d5de6af" origin="Generated by Gradle"/>

modules/lang-painless/src/main/java/org/elasticsearch/painless/DefBootstrap.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ protected MethodHandle computeValue(Class<?> receiverType) {
201201
try {
202202
return lookup(flavor, name, receiverType).asType(type);
203203
} catch (Throwable t) {
204-
Def.rethrow(t);
204+
// ClassValue.getFromHashMap wraps checked exceptions as Error, so we
205+
// use a sentinel class [PainlessWrappedException] here to work around
206+
// this issue and later unwrap the original exception
207+
Def.rethrow(t instanceof Exception ? new PainlessWrappedException((Exception) t) : t);
205208
throw new AssertionError();
206209
}
207210
}

modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScript.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public interface PainlessScript {
4646
* @return The generated ScriptException.
4747
*/
4848
default ScriptException convertToScriptException(Throwable t, Map<String, List<String>> extraMetadata) {
49+
if (t instanceof PainlessWrappedException) {
50+
t = t.getCause();
51+
}
4952
// create a script stack: this is just the script portion
5053
List<String> scriptStack = new ArrayList<>();
5154
ScriptException.Position pos = null;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.painless;
11+
12+
/**
13+
* Checked exceptions are wrapped in {@link ClassValue}#getFromHashMap in Error
14+
* which leads to unexpected behavior in Painless. This class is used as a
15+
* workaround for that exception wrapping.
16+
*/
17+
public class PainlessWrappedException extends Error {
18+
19+
/**
20+
* Constructor.
21+
* @param cause The {@link Exception} cause.
22+
*/
23+
public PainlessWrappedException(final Exception cause) {
24+
super(cause);
25+
}
26+
}

modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/PainlessUserTreeToIRTreePhase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.elasticsearch.painless.Location;
1313
import org.elasticsearch.painless.PainlessError;
1414
import org.elasticsearch.painless.PainlessExplainError;
15+
import org.elasticsearch.painless.PainlessWrappedException;
1516
import org.elasticsearch.painless.ScriptClassInfo;
1617
import org.elasticsearch.painless.ScriptClassInfo.MethodArgument;
1718
import org.elasticsearch.painless.ir.BinaryImplNode;
@@ -415,6 +416,7 @@ protected static void injectSandboxExceptions(FunctionNode irFunctionNode) {
415416

416417
for (Class<? extends Throwable> throwable : List.of(
417418
PainlessError.class,
419+
PainlessWrappedException.class,
418420
LinkageError.class,
419421
OutOfMemoryError.class,
420422
StackOverflowError.class,

modules/lang-painless/src/test/java/org/elasticsearch/painless/DefBootstrapTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ public void testMegamorphic() throws Throwable {
139139
map.put("a", "b");
140140
assertEquals(2, (int) handle.invokeExact((Object) map));
141141

142-
final IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () -> {
142+
final PainlessWrappedException pwe = expectThrows(PainlessWrappedException.class, () -> {
143143
Integer.toString((int) handle.invokeExact(new Object()));
144144
});
145+
assertTrue(pwe.getCause() instanceof IllegalArgumentException);
146+
IllegalArgumentException iae = (IllegalArgumentException) pwe.getCause();
145147
assertEquals("dynamic method [java.lang.Object, size/0] not found", iae.getMessage());
146148
assertTrue("Does not fail inside ClassValue.computeValue()", Arrays.stream(iae.getStackTrace()).anyMatch(e -> {
147149
return e.getMethodName().equals("computeValue") && e.getClassName().startsWith("org.elasticsearch.painless.DefBootstrap$PIC$");

0 commit comments

Comments
 (0)