Skip to content

Commit 4661330

Browse files
committed
Merge branch 'main' of https://github.com/elastic/elasticsearch into support_multi_inlinestats_logicalPlan_approach
2 parents a9e2d99 + 7d4bbcc commit 4661330

File tree

1,287 files changed

+6407
-5269
lines changed

Some content is hidden

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

1,287 files changed

+6407
-5269
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

benchmarks/src/main/java/org/elasticsearch/benchmark/search/query/range/DateFieldMapperDocValuesSkipperBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
import org.apache.lucene.index.IndexWriterConfig;
2222
import org.apache.lucene.search.IndexOrDocValuesQuery;
2323
import org.apache.lucene.search.IndexSearcher;
24+
import org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery;
2425
import org.apache.lucene.search.Query;
2526
import org.apache.lucene.search.Sort;
2627
import org.apache.lucene.search.SortField;
2728
import org.apache.lucene.search.SortedNumericSortField;
2829
import org.apache.lucene.store.Directory;
2930
import org.apache.lucene.store.FSDirectory;
3031
import org.apache.lucene.util.BytesRef;
31-
import org.elasticsearch.lucene.search.XIndexSortSortedNumericDocValuesRangeQuery;
3232
import org.openjdk.jmh.annotations.Benchmark;
3333
import org.openjdk.jmh.annotations.BenchmarkMode;
3434
import org.openjdk.jmh.annotations.Fork;
@@ -295,7 +295,7 @@ public void rangeQueryWithDocValuesSkipper(final Blackhole bh) throws IOExceptio
295295
/**
296296
* Runs the actual Lucene range query, optionally combining a {@link LongPoint} index query
297297
* with doc values ({@link SortedNumericDocValuesField}) via {@link IndexOrDocValuesQuery},
298-
* and then wrapping it with an {@link XIndexSortSortedNumericDocValuesRangeQuery} to utilize the index sort.
298+
* and then wrapping it with an {@link IndexSortSortedNumericDocValuesRangeQuery} to utilize the index sort.
299299
*
300300
* @param searcher the Lucene {@link IndexSearcher}
301301
* @param rangeStartTimestamp lower bound of the timestamp range
@@ -316,7 +316,7 @@ private long rangeQuery(final IndexSearcher searcher, long rangeStartTimestamp,
316316
)
317317
: SortedNumericDocValuesField.newSlowRangeQuery(TIMESTAMP_FIELD, rangeStartTimestamp, rangeEndTimestamp);
318318

319-
final Query query = new XIndexSortSortedNumericDocValuesRangeQuery(
319+
final Query query = new IndexSortSortedNumericDocValuesRangeQuery(
320320
TIMESTAMP_FIELD,
321321
rangeStartTimestamp,
322322
rangeEndTimestamp,

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.gradle.internal;
1111

1212
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin;
13-
import org.elasticsearch.gradle.internal.precommit.DependencyLicensesTask;
1413
import org.gradle.api.Plugin;
1514
import org.gradle.api.Project;
1615
import org.gradle.api.artifacts.Configuration;
@@ -28,14 +27,14 @@ public void apply(final Project project) {
2827
var depsInfo = project.getTasks().register("dependenciesInfo", DependenciesInfoTask.class);
2928

3029
depsInfo.configure(t -> {
31-
t.setRuntimeConfiguration(project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME));
32-
t.setCompileOnlyConfiguration(
33-
project.getConfigurations().getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME)
34-
);
35-
t.getConventionMapping().map("mappings", () -> {
36-
var depLic = project.getTasks().named("dependencyLicenses", DependencyLicensesTask.class);
37-
return depLic.get().getMappings();
38-
});
30+
var runtimeConfiguration = project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
31+
t.getRuntimeArtifacts().set(project.getProviders().provider(() -> runtimeConfiguration.getIncoming().getArtifacts()));
32+
t.getClasspath().from(runtimeConfiguration);
33+
var compileOnlyConfiguration = project.getConfigurations()
34+
.getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME);
35+
t.getCompileOnlyArtifacts().set(project.getProviders().provider(() -> compileOnlyConfiguration.getIncoming().getArtifacts()));
36+
t.getClasspath().from(compileOnlyConfiguration);
37+
3938
});
4039
Configuration dependenciesInfoFilesConfiguration = project.getConfigurations().create("dependenciesInfoFiles");
4140
dependenciesInfoFilesConfiguration.setCanBeResolved(false);

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

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@
1111

1212
import org.elasticsearch.gradle.internal.precommit.DependencyLicensesTask;
1313
import org.elasticsearch.gradle.internal.precommit.LicenseAnalyzer;
14-
import org.gradle.api.artifacts.Configuration;
15-
import org.gradle.api.artifacts.Dependency;
16-
import org.gradle.api.artifacts.DependencySet;
17-
import org.gradle.api.artifacts.ModuleVersionIdentifier;
14+
import org.gradle.api.artifacts.ArtifactCollection;
1815
import org.gradle.api.artifacts.ProjectDependency;
16+
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
17+
import org.gradle.api.file.ConfigurableFileCollection;
1918
import org.gradle.api.file.DirectoryProperty;
2019
import org.gradle.api.file.ProjectLayout;
2120
import org.gradle.api.internal.ConventionTask;
2221
import org.gradle.api.model.ObjectFactory;
22+
import org.gradle.api.provider.MapProperty;
23+
import org.gradle.api.provider.Property;
24+
import org.gradle.api.provider.Provider;
2325
import org.gradle.api.provider.ProviderFactory;
2426
import org.gradle.api.tasks.Input;
2527
import org.gradle.api.tasks.InputDirectory;
2628
import org.gradle.api.tasks.InputFiles;
29+
import org.gradle.api.tasks.Internal;
2730
import org.gradle.api.tasks.Optional;
2831
import org.gradle.api.tasks.OutputFile;
2932
import org.gradle.api.tasks.TaskAction;
@@ -34,6 +37,7 @@
3437
import java.nio.file.StandardOpenOption;
3538
import java.util.Arrays;
3639
import java.util.LinkedHashMap;
40+
import java.util.Map;
3741
import java.util.Set;
3842
import java.util.regex.Pattern;
3943
import java.util.stream.Collectors;
@@ -51,31 +55,58 @@
5155
* <li>license: <a href="https://spdx.org/licenses/">SPDX license</a> identifier, custom license or UNKNOWN.</li>
5256
* </ul>
5357
*/
54-
public class DependenciesInfoTask extends ConventionTask {
58+
public abstract class DependenciesInfoTask extends ConventionTask {
5559

56-
private final DirectoryProperty licensesDir;
60+
@Inject
61+
public abstract ProviderFactory getProviderFactory();
5762

58-
@OutputFile
59-
private File outputFile;
63+
/**
64+
* We have to use ArtifactCollection instead of ResolvedArtifactResult here as we're running
65+
* into a an issue in Gradle: https://github.com/gradle/gradle/issues/27582
66+
*/
6067

61-
private LinkedHashMap<String, String> mappings;
68+
@Internal
69+
abstract Property<ArtifactCollection> getRuntimeArtifacts();
6270

63-
public Configuration getRuntimeConfiguration() {
64-
return runtimeConfiguration;
71+
@Input
72+
public Provider<Set<ModuleComponentIdentifier>> getRuntimeModules() {
73+
return mapToModuleComponentIdentifiers(getRuntimeArtifacts().get());
6574
}
6675

67-
public void setRuntimeConfiguration(Configuration runtimeConfiguration) {
68-
this.runtimeConfiguration = runtimeConfiguration;
69-
}
76+
@Internal
77+
abstract Property<ArtifactCollection> getCompileOnlyArtifacts();
7078

71-
public Configuration getCompileOnlyConfiguration() {
72-
return compileOnlyConfiguration;
79+
@Input
80+
public Provider<Set<ModuleComponentIdentifier>> getCompileOnlyModules() {
81+
return mapToModuleComponentIdentifiers(getCompileOnlyArtifacts().get());
7382
}
7483

75-
public void setCompileOnlyConfiguration(Configuration compileOnlyConfiguration) {
76-
this.compileOnlyConfiguration = compileOnlyConfiguration;
84+
/**
85+
* We need to track file inputs here from the configurations we inspect to ensure we dont miss any
86+
* artifact transforms that might be applied and fail due to missing task dependency to jar
87+
* generating tasks.
88+
* */
89+
@InputFiles
90+
abstract ConfigurableFileCollection getClasspath();
91+
92+
private Provider<Set<ModuleComponentIdentifier>> mapToModuleComponentIdentifiers(ArtifactCollection artifacts) {
93+
return getProviderFactory().provider(
94+
() -> artifacts.getArtifacts()
95+
.stream()
96+
.map(r -> r.getId())
97+
.filter(id -> id instanceof ModuleComponentIdentifier)
98+
.map(id -> (ModuleComponentIdentifier) id)
99+
.collect(Collectors.toSet())
100+
);
77101
}
78102

103+
private final DirectoryProperty licensesDir;
104+
105+
@OutputFile
106+
private File outputFile;
107+
108+
private LinkedHashMap<String, String> mappings;
109+
79110
/**
80111
* Directory to read license files
81112
*/
@@ -102,17 +133,6 @@ public void setOutputFile(File outputFile) {
102133
this.outputFile = outputFile;
103134
}
104135

105-
/**
106-
* Dependencies to gather information from.
107-
*/
108-
@InputFiles
109-
private Configuration runtimeConfiguration;
110-
/**
111-
* We subtract compile-only dependencies.
112-
*/
113-
@InputFiles
114-
private Configuration compileOnlyConfiguration;
115-
116136
@Inject
117137
public DependenciesInfoTask(ProjectLayout projectLayout, ObjectFactory objectFactory, ProviderFactory providerFactory) {
118138
this.licensesDir = objectFactory.directoryProperty();
@@ -123,22 +143,18 @@ public DependenciesInfoTask(ProjectLayout projectLayout, ObjectFactory objectFac
123143

124144
@TaskAction
125145
public void generateDependenciesInfo() throws IOException {
126-
final DependencySet runtimeDependencies = runtimeConfiguration.getAllDependencies();
127-
// we have to resolve the transitive dependencies and create a group:artifactId:version map
128-
129-
final Set<String> compileOnlyArtifacts = compileOnlyConfiguration.getResolvedConfiguration()
130-
.getResolvedArtifacts()
131-
.stream()
132-
.map(r -> {
133-
ModuleVersionIdentifier id = r.getModuleVersion().getId();
134-
return id.getGroup() + ":" + id.getName() + ":" + id.getVersion();
135-
})
136-
.collect(Collectors.toSet());
137146

147+
final Set<String> compileOnlyIds = getCompileOnlyModules().map(
148+
set -> set.stream()
149+
.map(id -> id.getModuleIdentifier().getGroup() + ":" + id.getModuleIdentifier().getName() + ":" + id.getVersion())
150+
.collect(Collectors.toSet())
151+
).get();
138152
final StringBuilder output = new StringBuilder();
139-
for (final Dependency dep : runtimeDependencies) {
153+
Map<String, String> mappings = getMappings().get();
154+
for (final ModuleComponentIdentifier dep : getRuntimeModules().get()) {
140155
// we do not need compile-only dependencies here
141-
if (compileOnlyArtifacts.contains(dep.getGroup() + ":" + dep.getName() + ":" + dep.getVersion())) {
156+
String moduleName = dep.getModuleIdentifier().getName();
157+
if (compileOnlyIds.contains(dep.getGroup() + ":" + moduleName + ":" + dep.getVersion())) {
142158
continue;
143159
}
144160

@@ -147,25 +163,20 @@ public void generateDependenciesInfo() throws IOException {
147163
continue;
148164
}
149165

150-
final String url = createURL(dep.getGroup(), dep.getName(), dep.getVersion());
151-
final String dependencyName = DependencyLicensesTask.getDependencyName(getMappings(), dep.getName());
152-
getLogger().info("mapped dependency " + dep.getGroup() + ":" + dep.getName() + " to " + dependencyName + " for license info");
166+
final String url = createURL(dep.getGroup(), moduleName, dep.getVersion());
167+
final String dependencyName = DependencyLicensesTask.getDependencyName(mappings, moduleName);
168+
getLogger().info("mapped dependency " + dep.getGroup() + ":" + moduleName + " to " + dependencyName + " for license info");
153169

154170
final String licenseType = getLicenseType(dep.getGroup(), dependencyName);
155-
output.append(dep.getGroup() + ":" + dep.getName() + "," + dep.getVersion() + "," + url + "," + licenseType + "\n");
171+
output.append(dep.getGroup() + ":" + moduleName + "," + dep.getVersion() + "," + url + "," + licenseType + "\n");
156172
}
157173

158174
Files.writeString(outputFile.toPath(), output.toString(), StandardOpenOption.CREATE);
159175
}
160176

161177
@Input
162-
public LinkedHashMap<String, String> getMappings() {
163-
return mappings;
164-
}
165-
166-
public void setMappings(LinkedHashMap<String, String> mappings) {
167-
this.mappings = mappings;
168-
}
178+
@Optional
179+
public abstract MapProperty<String, String> getMappings();
169180

170181
/**
171182
* Create an URL on <a href="https://repo1.maven.org/maven2/">Maven Central</a>

build-tools-internal/src/main/resources/forbidden/es-all-signatures.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,3 @@ org.apache.logging.log4j.message.ParameterizedMessage#<init>(java.lang.String, j
6161

6262
@defaultMessage Use WriteLoadForecaster#getForecastedWriteLoad instead
6363
org.elasticsearch.cluster.metadata.IndexMetadata#getForecastedWriteLoad()
64-
65-
# This is a temporary patch as there is a low level Lucene bug in certain scenarios
66-
# this should be fixed in the new Lucene release 10.3+
67-
org.apache.lucene.document.LongField#newExactQuery(java.lang.String, long) @ Use org.elasticsearch.lucene.document.NumericField#newExactLongQuery(java.lang.String, long) instead.
68-
org.apache.lucene.document.LongField#newRangeQuery(java.lang.String, long, long) @ Use org.elasticsearch.lucene.document.NumericField#newRangeLongQuery(java.lang.String, long, long) instead.
69-
org.apache.lucene.document.IntField#newExactQuery(java.lang.String, int) @ Use org.elasticsearch.lucene.document.NumericField#newExactIntQuery(java.lang.String, int) instead.
70-
org.apache.lucene.document.IntField#newRangeQuery(java.lang.String, int, int) @ Use org.elasticsearch.lucene.document.NumericField#newRangeIntQuery(java.lang.String, int, int) instead.
71-
org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery @ use org.elasticsearch.lucene.search.XIndexSortSortedNumericDocValuesRangeQuery instead.

build-tools-internal/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 9.1.0
2-
lucene = 10.2.1
2+
lucene = 10.2.2
33

44
bundled_jdk_vendor = openjdk
55
bundled_jdk = 24+36@1f9ff9062db4449d8ca828c504ffae90

0 commit comments

Comments
 (0)