Skip to content

Commit 81fd893

Browse files
authored
Merge branch 'main' into ivf_centroidRaw
2 parents 5a2c320 + f739673 commit 81fd893

File tree

56 files changed

+2749
-228
lines changed

Some content is hidden

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

56 files changed

+2749
-228
lines changed

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

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.io.File;
3535
import java.util.List;
3636
import java.util.Map;
37+
import java.util.Set;
3738
import java.util.stream.Stream;
3839

3940
import javax.inject.Inject;
@@ -50,6 +51,8 @@ public abstract class ElasticsearchTestBasePlugin implements Plugin<Project> {
5051

5152
public static final String DUMP_OUTPUT_ON_FAILURE_PROP_NAME = "dumpOutputOnFailure";
5253

54+
public static final Set<String> TEST_TASKS_WITH_ENTITLEMENTS = Set.of("test", "internalClusterTest");
55+
5356
@Inject
5457
protected abstract ProviderFactory getProviderFactory();
5558

@@ -174,14 +177,23 @@ public void execute(Task t) {
174177
nonInputProperties.systemProperty("workspace.dir", Util.locateElasticsearchWorkspace(project.getGradle()));
175178
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
176179
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
180+
if (test.getName().equals("internalClusterTest")) {
181+
// configure a node home directory independent of the Java temp dir so that entitlements can be properly enforced
182+
nonInputProperties.systemProperty("tempDir", test.getWorkingDir().toPath().resolve("nodesTemp"));
183+
}
177184

178185
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
179186
SourceSet mainSourceSet = sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME);
180187
SourceSet testSourceSet = sourceSets.findByName(SourceSet.TEST_SOURCE_SET_NAME);
181-
if ("test".equals(test.getName()) && mainSourceSet != null && testSourceSet != null) {
188+
SourceSet internalClusterTestSourceSet = sourceSets.findByName("internalClusterTest");
189+
190+
if (TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()) && mainSourceSet != null && testSourceSet != null) {
182191
FileCollection mainRuntime = mainSourceSet.getRuntimeClasspath();
183192
FileCollection testRuntime = testSourceSet.getRuntimeClasspath();
184-
FileCollection testOnlyFiles = testRuntime.minus(mainRuntime);
193+
FileCollection internalClusterTestRuntime = ("internalClusterTest".equals(test.getName())
194+
&& internalClusterTestSourceSet != null) ? internalClusterTestSourceSet.getRuntimeClasspath() : project.files();
195+
FileCollection testOnlyFiles = testRuntime.plus(internalClusterTestRuntime).minus(mainRuntime);
196+
185197
test.doFirst(task -> test.environment("es.entitlement.testOnlyPath", testOnlyFiles.getAsPath()));
186198
}
187199

@@ -241,14 +253,15 @@ public void execute(Task t) {
241253
* Computes and sets the {@code --patch-module=java.base} and {@code --add-opens=java.base} JVM command line options.
242254
*/
243255
private void configureJavaBaseModuleOptions(Project project) {
244-
project.getTasks().withType(Test.class).matching(task -> task.getName().equals("test")).configureEach(test -> {
245-
FileCollection patchedImmutableCollections = patchedImmutableCollections(project);
256+
project.getTasks().withType(Test.class).configureEach(test -> {
257+
// patch immutable collections only for "test" task
258+
FileCollection patchedImmutableCollections = test.getName().equals("test") ? patchedImmutableCollections(project) : null;
246259
if (patchedImmutableCollections != null) {
247260
test.getInputs().files(patchedImmutableCollections);
248261
test.systemProperty("tests.hackImmutableCollections", "true");
249262
}
250263

251-
FileCollection entitlementBridge = entitlementBridge(project);
264+
FileCollection entitlementBridge = TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()) ? entitlementBridge(project) : null;
252265
if (entitlementBridge != null) {
253266
test.getInputs().files(entitlementBridge);
254267
}
@@ -312,27 +325,30 @@ private static void configureEntitlements(Project project) {
312325
}
313326
FileCollection bridgeFiles = bridgeConfig;
314327

315-
project.getTasks().withType(Test.class).configureEach(test -> {
316-
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
317-
318-
// Agent
319-
if (agentFiles.isEmpty() == false) {
320-
test.getInputs().files(agentFiles);
321-
test.systemProperty("es.entitlement.agentJar", agentFiles.getAsPath());
322-
test.systemProperty("jdk.attach.allowAttachSelf", true);
323-
}
328+
project.getTasks()
329+
.withType(Test.class)
330+
.matching(test -> TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()))
331+
.configureEach(test -> {
332+
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
333+
334+
// 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+
}
324340

325-
// Bridge
326-
if (bridgeFiles.isEmpty() == false) {
327-
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
328-
test.getInputs().files(bridgeFiles);
329-
// Tests may not be modular, but the JDK still is
330-
test.jvmArgs(
331-
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
332-
+ modulesContainingEntitlementInstrumentation
333-
);
334-
}
335-
});
341+
// 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+
}
351+
});
336352
}
337353

338354
}

build-tools/src/main/java/org/elasticsearch/gradle/test/TestBuildInfoPlugin.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ public void apply(Project project) {
5858
});
5959

6060
if (project.getRootProject().getName().equals("elasticsearch")) {
61-
project.getTasks().withType(Test.class).matching(test -> List.of("test").contains(test.getName())).configureEach(test -> {
62-
test.systemProperty("es.entitlement.enableForTests", "true");
63-
});
61+
project.getTasks()
62+
.withType(Test.class)
63+
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
64+
.configureEach(test -> {
65+
test.systemProperty("es.entitlement.enableForTests", "true");
66+
});
6467
}
6568
}
6669
}

docs/changelog/129848.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129848
2+
summary: "[ML] Add Azure AI Rerank support to the Inference Plugin"
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/131391.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 131391
2+
summary: Fix bug in point in time response
3+
area: Search
4+
type: bug
5+
issues:
6+
- 131026

libs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ configure(childProjects.values()) {
5050
// Omit oddball libraries that aren't in server.
5151
def nonServerLibs = ['plugin-scanner']
5252
if (false == nonServerLibs.contains(project.name)) {
53-
project.getTasks().withType(Test.class).matching(test -> ['test'].contains(test.name)).configureEach(test -> {
53+
project.getTasks().withType(Test.class).matching(test -> ['test', 'internalClusterTest'].contains(test.name)).configureEach(test -> {
5454
test.systemProperty('es.entitlement.enableForTests', 'true')
5555
})
5656
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
// 'WindowsFS.checkDeleteAccess(...)').
5858
}
5959
)
60-
public class ReloadingDatabasesWhilePerformingGeoLookupsIT extends ESTestCase {
60+
public class ReloadingDatabasesWhilePerformingGeoLookupsTests extends ESTestCase {
6161

6262
/**
6363
* This tests essentially verifies that a Maxmind database reader doesn't fail with:

modules/repository-s3/src/main/resources/org/elasticsearch/repositories/s3/regions_by_endpoint.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ap-east-1 s3-fips.ap-east-1.amazonaws.com
66
ap-east-1 s3-fips.dualstack.ap-east-1.amazonaws.com
77
ap-east-1 s3.ap-east-1.amazonaws.com
88
ap-east-1 s3.dualstack.ap-east-1.amazonaws.com
9+
ap-east-2 s3-fips.ap-east-2.amazonaws.com
10+
ap-east-2 s3-fips.dualstack.ap-east-2.amazonaws.com
11+
ap-east-2 s3.ap-east-2.amazonaws.com
12+
ap-east-2 s3.dualstack.ap-east-2.amazonaws.com
913
ap-northeast-1 s3-fips.ap-northeast-1.amazonaws.com
1014
ap-northeast-1 s3-fips.dualstack.ap-northeast-1.amazonaws.com
1115
ap-northeast-1 s3.ap-northeast-1.amazonaws.com
@@ -56,6 +60,14 @@ aws-iso-b-global s3-fips.aws-iso-b-global.sc2s.sgov.gov
5660
aws-iso-b-global s3-fips.dualstack.aws-iso-b-global.sc2s.sgov.gov
5761
aws-iso-b-global s3.aws-iso-b-global.sc2s.sgov.gov
5862
aws-iso-b-global s3.dualstack.aws-iso-b-global.sc2s.sgov.gov
63+
aws-iso-e-global s3-fips.aws-iso-e-global.cloud.adc-e.uk
64+
aws-iso-e-global s3-fips.dualstack.aws-iso-e-global.cloud.adc-e.uk
65+
aws-iso-e-global s3.aws-iso-e-global.cloud.adc-e.uk
66+
aws-iso-e-global s3.dualstack.aws-iso-e-global.cloud.adc-e.uk
67+
aws-iso-f-global s3-fips.aws-iso-f-global.csp.hci.ic.gov
68+
aws-iso-f-global s3-fips.dualstack.aws-iso-f-global.csp.hci.ic.gov
69+
aws-iso-f-global s3.aws-iso-f-global.csp.hci.ic.gov
70+
aws-iso-f-global s3.dualstack.aws-iso-f-global.csp.hci.ic.gov
5971
aws-iso-global s3-fips.aws-iso-global.c2s.ic.gov
6072
aws-iso-global s3-fips.dualstack.aws-iso-global.c2s.ic.gov
6173
aws-iso-global s3.aws-iso-global.c2s.ic.gov
@@ -76,6 +88,10 @@ cn-north-1 s3.cn-north-1.amazonaws.com.cn
7688
cn-north-1 s3.dualstack.cn-north-1.amazonaws.com.cn
7789
cn-northwest-1 s3.cn-northwest-1.amazonaws.com.cn
7890
cn-northwest-1 s3.dualstack.cn-northwest-1.amazonaws.com.cn
91+
eusc-de-east-1 s3-fips.eusc-de-east-1.amazonaws.eu
92+
eusc-de-east-1 s3-fips.dualstack.eusc-de-east-1.amazonaws.eu
93+
eusc-de-east-1 s3.eusc-de-east-1.amazonaws.eu
94+
eusc-de-east-1 s3.dualstack.eusc-de-east-1.amazonaws.eu
7995
eu-central-1 s3-fips.dualstack.eu-central-1.amazonaws.com
8096
eu-central-1 s3-fips.eu-central-1.amazonaws.com
8197
eu-central-1 s3.dualstack.eu-central-1.amazonaws.com

modules/repository-s3/src/test/java/org/elasticsearch/repositories/s3/RegionFromEndpointGuesserTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
package org.elasticsearch.repositories.s3;
1111

12+
import software.amazon.awssdk.endpoints.Endpoint;
13+
import software.amazon.awssdk.regions.Region;
14+
import software.amazon.awssdk.services.s3.endpoints.S3EndpointParams;
15+
import software.amazon.awssdk.services.s3.endpoints.internal.DefaultS3EndpointProvider;
16+
1217
import org.elasticsearch.core.Nullable;
1318
import org.elasticsearch.test.ESTestCase;
1419

@@ -23,6 +28,14 @@ public void testRegionGuessing() {
2328
assertRegionGuess("random.endpoint.internal.net", null);
2429
}
2530

31+
public void testHasEntryForEachRegion() {
32+
final var defaultS3EndpointProvider = new DefaultS3EndpointProvider();
33+
for (var region : Region.regions()) {
34+
final Endpoint endpoint = safeGet(defaultS3EndpointProvider.resolveEndpoint(S3EndpointParams.builder().region(region).build()));
35+
assertNotNull(region.id(), RegionFromEndpointGuesser.guessRegion(endpoint.url().toString()));
36+
}
37+
}
38+
2639
private static void assertRegionGuess(String endpoint, @Nullable String expectedRegion) {
2740
assertEquals(endpoint, expectedRegion, RegionFromEndpointGuesser.guessRegion(endpoint));
2841
}

server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.gateway.PersistedClusterStateService;
2525
import org.elasticsearch.node.Node;
2626
import org.elasticsearch.test.ESIntegTestCase;
27+
import org.elasticsearch.test.ESTestCase;
2728
import org.elasticsearch.test.InternalTestCluster;
2829

2930
import java.io.IOException;
@@ -39,6 +40,7 @@
3940
import static org.hamcrest.Matchers.notNullValue;
4041

4142
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false)
43+
@ESTestCase.WithoutEntitlements // CLI tools don't run with entitlements enforced
4244
public class UnsafeBootstrapAndDetachCommandIT extends ESIntegTestCase {
4345

4446
private MockTerminal executeCommand(ElasticsearchNodeCommand command, Environment environment, boolean abort) throws Exception {

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static TransportVersion def(int id) {
341341
public static final TransportVersion LOOKUP_JOIN_CCS = def(9_120_0_00);
342342
public static final TransportVersion NODE_USAGE_STATS_FOR_THREAD_POOLS_IN_CLUSTER_INFO = def(9_121_0_00);
343343
public static final TransportVersion ESQL_CATEGORIZE_OPTIONS = def(9_122_0_00);
344+
public static final TransportVersion ML_INFERENCE_AZURE_AI_STUDIO_RERANK_ADDED = def(9_123_0_00);
344345

345346
/*
346347
* STOP! READ THIS FIRST! No, really,

0 commit comments

Comments
 (0)