Skip to content

Commit 583e5f1

Browse files
authored
Merge branch 'main' into markjhoy/add_sparse_vector_token_pruning_index_options
2 parents 8a80167 + 81bb0b5 commit 583e5f1

File tree

64 files changed

+4148
-2929
lines changed

Some content is hidden

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

64 files changed

+4148
-2929
lines changed

.buildkite/scripts/run-bc-upgrade-tests.sh

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,17 @@ echo "Running BC upgrade tests on $BUILDKITE_BRANCH [$BC_VERSION] using BC (or s
5656

5757
cat <<EOF | buildkite-agent pipeline upload
5858
steps:
59-
- label: bc-upgrade $BC_BUILD_ID -> $BUILDKITE_BRANCH
60-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-file-fingerprints -Dtests.bwc.main.version=${BC_VERSION} -Dtests.bwc.refspec.main=${BC_COMMIT_HASH} bcUpgradeTest -Dtests.jvm.argline="-Des.serverless_transport=true"
61-
timeout_in_minutes: 300
62-
agents:
63-
provider: gcp
64-
image: family/elasticsearch-ubuntu-2004
65-
machineType: n1-standard-32
66-
buildDirectory: /dev/shm/bk
67-
preemptible: true
68-
retry:
69-
automatic:
70-
- exit_status: "-1"
71-
limit: 3
72-
signal_reason: none
73-
- signal_reason: agent_stop
74-
limit: 3
59+
- group: "bc-upgrade $BC_BUILD_ID -> $BUILDKITE_BRANCH"
60+
steps:
61+
- label: "bc-upgrade-tests-part{{matrix.PART}}"
62+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-file-fingerprints -Dtests.bwc.main.version=${BC_VERSION} -Dtests.bwc.refspec.main=${BC_COMMIT_HASH} bcUpgradeTestPart{{matrix.PART}}
63+
timeout_in_minutes: 300
64+
agents:
65+
provider: gcp
66+
image: family/elasticsearch-ubuntu-2004
67+
machineType: n1-standard-32
68+
buildDirectory: /dev/shm/bk
69+
matrix:
70+
setup:
71+
PART: ["1", "2", "3", "4", "5", "6"]
7572
EOF

.buildkite/scripts/run-pr-upgrade-tests.sh

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ VERSION=$(sed -n 's/^elasticsearch[[:space:]]*=[[:space:]]*\(.*\)/\1/p' build-to
2424

2525
echo "Running PR upgrade tests from $BUILDKITE_PULL_REQUEST_BASE_BRANCH [$BASE_COMMIT] to $BUILDKITE_BRANCH [$BUILDKITE_COMMIT]."
2626

27-
cat <<EOF | buildkite-agent pipeline upload
27+
cat << EOF | buildkite-agent pipeline upload
2828
steps:
29-
- label: pr-upgrade $BUILDKITE_PULL_REQUEST_BASE_BRANCH -> $BUILDKITE_BRANCH
30-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-file-fingerprints -Dtests.bwc.main.version=${VERSION}-SNAPSHOT -Dtests.bwc.refspec.main=${BASE_COMMIT} bcUpgradeTest -Dtests.jvm.argline="-Des.serverless_transport=true"
31-
timeout_in_minutes: 300
32-
agents:
33-
provider: gcp
34-
image: family/elasticsearch-ubuntu-2004
35-
machineType: n1-standard-32
36-
buildDirectory: /dev/shm/bk
37-
preemptible: true
38-
retry:
39-
automatic:
40-
- exit_status: "-1"
41-
limit: 3
42-
signal_reason: none
43-
- signal_reason: agent_stop
44-
limit: 3
29+
- group: "pr-upgrade $BUILDKITE_PULL_REQUEST_BASE_BRANCH -> $BUILDKITE_BRANCH"
30+
steps:
31+
- label: "pr-upgrade-part-{{matrix.PART}}"
32+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-file-fingerprints -Dtests.bwc.main.version=${VERSION}-SNAPSHOT -Dtests.bwc.refspec.main=${BASE_COMMIT} bcUpgradeTestPart{{matrix.PART}}
33+
timeout_in_minutes: 300
34+
agents:
35+
provider: gcp
36+
image: family/elasticsearch-ubuntu-2004
37+
machineType: n1-standard-32
38+
buildDirectory: /dev/shm/bk
39+
matrix:
40+
setup:
41+
PART: ["1", "2", "3", "4", "5", "6"]
4542
EOF

.github/workflows/docs-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
deployments: write
1717
id-token: write
1818
contents: read
19-
pull-requests: read
19+
pull-requests: write

build.gradle

Lines changed: 30 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -351,95 +351,45 @@ allprojects {
351351
}
352352
}
353353

354+
def splitForCI = { proj, partString ->
355+
proj.tasks.register("check$partString") {
356+
dependsOn 'check'
357+
withReleaseBuild {
358+
dependsOn 'assemble'
359+
}
360+
}
361+
362+
proj.tasks.addRule("Pattern: v<BWC_VERSION>#bwcTest$partString") { name ->
363+
if(name.endsWith("#bwcTest$partString")) {
364+
proj.project.getTasks().register(name) {
365+
task -> task.dependsOn(proj.tasks.named { tskName -> tskName == (name - partString) })
366+
}
367+
}
368+
}
369+
370+
proj.tasks.register("bcUpgradeTest$partString") {
371+
dependsOn tasks.matching { it.name == 'bcUpgradeTest' }
372+
withReleaseBuild {
373+
dependsOn 'assemble'
374+
}
375+
}
376+
}
377+
354378
plugins.withId('lifecycle-base') {
355379
if (project.path.startsWith(":x-pack:")) {
356380
if (project.path.contains("security") || project.path.contains(":ml")) {
357-
tasks.register('checkPart4') {
358-
dependsOn 'check'
359-
withReleaseBuild {
360-
dependsOn 'assemble'
361-
}
362-
}
363-
364-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart4") { name ->
365-
if(name.endsWith("#bwcTestPart4")) {
366-
project.getTasks().register(name) {
367-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part4") })
368-
}
369-
}
370-
}
381+
splitForCI(project, "Part4")
371382
} else if (project.path == ":x-pack:plugin" || project.path.contains("ql") || project.path.contains("smoke-test")) {
372-
tasks.register('checkPart3') {
373-
dependsOn 'check'
374-
withReleaseBuild {
375-
dependsOn 'assemble'
376-
}
377-
}
378-
379-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart3") { name ->
380-
if(name.endsWith("#bwcTestPart3")) {
381-
project.getTasks().register(name) {
382-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part3") })
383-
}
384-
}
385-
}
383+
splitForCI(project, "Part3")
386384
} else if (project.path.contains("multi-node")) {
387-
tasks.register('checkPart5') {
388-
dependsOn 'check'
389-
withReleaseBuild {
390-
dependsOn 'assemble'
391-
}
392-
}
393-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart5") { name ->
394-
if(name.endsWith("#bwcTestPart5")) {
395-
project.getTasks().register(name) {
396-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part5") })
397-
}
398-
}
399-
}
385+
splitForCI(project, "Part5")
400386
} else {
401-
tasks.register('checkPart2') {
402-
dependsOn 'check'
403-
withReleaseBuild {
404-
dependsOn 'assemble'
405-
}
406-
}
407-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart2") { name ->
408-
if(name.endsWith("#bwcTestPart2")) {
409-
project.getTasks().register(name) {
410-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part2") })
411-
}
412-
}
413-
}
387+
splitForCI(project, "Part2")
414388
}
415389
} else if(project.path.startsWith(":qa:")) {
416-
tasks.register('checkPart6') {
417-
dependsOn 'check'
418-
withReleaseBuild {
419-
dependsOn 'assemble'
420-
}
421-
}
422-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart6") { name ->
423-
if(name.endsWith("#bwcTestPart6")) {
424-
project.getTasks().register(name) {
425-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part6") })
426-
}
427-
}
428-
}
390+
splitForCI(project, "Part6")
429391
} else {
430-
tasks.register('checkPart1') {
431-
dependsOn 'check'
432-
withReleaseBuild {
433-
dependsOn 'assemble'
434-
}
435-
}
436-
tasks.addRule("Pattern: v<BWC_VERSION>#bwcTestPart1") { name ->
437-
if(name.endsWith("#bwcTestPart1")) {
438-
project.getTasks().register(name) {
439-
task -> task.dependsOn(tasks.named { tskName -> tskName == (name - "Part1") })
440-
}
441-
}
442-
}
392+
splitForCI(project, "Part1")
443393
}
444394
tasks.register('functionalTests') {
445395
dependsOn 'check'

docs/changelog/129503.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 129503
2+
summary: Pushdown Lookup Join past Project
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 119082
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
apply plugin: 'elasticsearch.internal-java-rest-test'
11+
12+
dependencies {
13+
javaRestTestImplementation project(':modules:ingest-geoip')
14+
javaRestTestImplementation project(':test:external-modules:test-multi-project')
15+
javaRestTestImplementation project(':test:fixtures:geoip-fixture')
16+
17+
clusterModules project(':modules:ingest-geoip')
18+
clusterModules project(':modules:reindex') // needed for database cleanup
19+
clusterModules project(':test:external-modules:test-multi-project')
20+
}
21+
22+
tasks.withType(Test).configureEach {
23+
it.systemProperty "tests.multi_project.enabled", true
24+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
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 geoip;
11+
12+
import fixture.geoip.GeoIpHttpFixture;
13+
14+
import org.elasticsearch.client.Request;
15+
import org.elasticsearch.client.RequestOptions;
16+
import org.elasticsearch.core.Booleans;
17+
import org.elasticsearch.ingest.geoip.GeoIpDownloader;
18+
import org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor;
19+
import org.elasticsearch.tasks.Task;
20+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
21+
import org.elasticsearch.test.rest.ESRestTestCase;
22+
import org.elasticsearch.test.rest.ObjectPath;
23+
import org.junit.ClassRule;
24+
import org.junit.rules.RuleChain;
25+
import org.junit.rules.TestRule;
26+
27+
import java.io.IOException;
28+
import java.util.List;
29+
import java.util.Map;
30+
import java.util.Objects;
31+
import java.util.Set;
32+
import java.util.concurrent.TimeUnit;
33+
import java.util.stream.Collectors;
34+
35+
import static org.hamcrest.Matchers.equalTo;
36+
37+
public class GeoIpMultiProjectIT extends ESRestTestCase {
38+
// default true
39+
private static final boolean useFixture = Booleans.parseBoolean(System.getProperty("geoip_use_service", "false")) == false;
40+
41+
public static final GeoIpHttpFixture fixture = new GeoIpHttpFixture(useFixture);
42+
43+
public static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
44+
.module("ingest-geoip")
45+
.module("reindex") // for database cleanup
46+
.module("test-multi-project")
47+
.setting("test.multi_project.enabled", "true")
48+
.setting(GeoIpDownloaderTaskExecutor.ENABLED_SETTING.getKey(), "true")
49+
.setting(GeoIpDownloader.ENDPOINT_SETTING.getKey(), fixture::getAddress, (k) -> useFixture)
50+
.build();
51+
52+
@ClassRule
53+
public static TestRule ruleChain = RuleChain.outerRule(fixture).around(cluster);
54+
55+
@Override
56+
protected String getTestRestCluster() {
57+
return cluster.getHttpAddresses();
58+
}
59+
60+
@Override
61+
protected boolean shouldConfigureProjects() {
62+
return false;
63+
}
64+
65+
public void testGeoIpDownloader() throws Exception {
66+
String project1 = randomUniqueProjectId().id();
67+
String project2 = randomUniqueProjectId().id();
68+
createProject(project1);
69+
createProject(project2);
70+
71+
// download databases for project1
72+
putGeoIpPipeline(project1);
73+
assertBusy(() -> assertDatabases(project1, true), 30, TimeUnit.SECONDS);
74+
assertBusy(() -> assertDatabases(project2, false), 30, TimeUnit.SECONDS);
75+
76+
// download databases for project2
77+
putGeoIpPipeline(project2);
78+
assertBusy(() -> assertDatabases(project2, true), 30, TimeUnit.SECONDS);
79+
}
80+
81+
private void putGeoIpPipeline(String projectId) throws IOException {
82+
Request putPipelineRequest = new Request("PUT", "/_ingest/pipeline/geoip-pipeline");
83+
putPipelineRequest.setJsonEntity("""
84+
{
85+
"processors" : [
86+
{
87+
"geoip" : {
88+
"field" : "ip",
89+
"target_field" : "geo",
90+
"database_file" : "GeoLite2-Country.mmdb"
91+
}
92+
}
93+
]
94+
}
95+
""");
96+
setRequestProjectId(projectId, putPipelineRequest);
97+
assertOK(client().performRequest(putPipelineRequest));
98+
}
99+
100+
private static Request setRequestProjectId(String projectId, Request request) {
101+
RequestOptions.Builder options = request.getOptions().toBuilder();
102+
options.removeHeader(Task.X_ELASTIC_PROJECT_ID_HTTP_HEADER);
103+
options.addHeader(Task.X_ELASTIC_PROJECT_ID_HTTP_HEADER, projectId);
104+
request.setOptions(options);
105+
return request;
106+
}
107+
108+
@SuppressWarnings("unchecked")
109+
private void assertDatabases(String projectId, boolean shouldDownload) throws IOException {
110+
Request getTaskState = new Request("GET", "/_cluster/state");
111+
setRequestProjectId(projectId, getTaskState);
112+
113+
ObjectPath state = ObjectPath.createFromResponse(assertOK(client().performRequest(getTaskState)));
114+
115+
List<Map<String, ?>> tasks = state.evaluate("metadata.persistent_tasks.tasks");
116+
// Short-circuit to avoid using steams if the list is empty
117+
if (tasks.isEmpty()) {
118+
fail("persistent tasks list is empty, expected at least one task for geoip-downloader");
119+
}
120+
121+
// verify project task id
122+
Set<Map<String, ?>> id = tasks.stream()
123+
.filter(task -> String.format("%s/geoip-downloader", projectId).equals(task.get("id")))
124+
.collect(Collectors.toSet());
125+
assertThat(id.size(), equalTo(1));
126+
127+
// verify database download
128+
Map<String, Object> databases = (Map<String, Object>) tasks.stream().map(task -> {
129+
try {
130+
return ObjectPath.evaluate(task, "task.geoip-downloader.state.databases");
131+
} catch (IOException e) {
132+
return null;
133+
}
134+
}).filter(Objects::nonNull).findFirst().orElse(null);
135+
136+
if (shouldDownload) {
137+
// verify database downloaded
138+
assertNotNull(databases);
139+
for (String name : List.of("GeoLite2-ASN.mmdb", "GeoLite2-City.mmdb", "GeoLite2-Country.mmdb")) {
140+
Object database = databases.get(name);
141+
assertNotNull(database);
142+
assertNotNull(ObjectPath.evaluate(database, "md5"));
143+
}
144+
} else {
145+
// verify database not downloaded
146+
assertNull(databases);
147+
}
148+
149+
}
150+
}

0 commit comments

Comments
 (0)