Skip to content

Commit 34a8e40

Browse files
committed
Merge branch 'master' into feature/data_stream_support_routing
* master: (185 commits) Implement get and containsKey in terms of the wrapped innerMap (elastic#77965) Adjust Lucene version and enable BWC tests (elastic#77933) Disable BWC to upgrade to Lucene-8.10-snapshot Reenable MlDistributedFailureIT [DOCS] Fix typo for `script.painless.regex.enabled` setting value (elastic#77853) Upgrade to Lucene-8.10.0-snapshot-bf2fcb53079 (elastic#77801) [DOCS] Fix ESS install lead-in (elastic#77887) Resolve thirdparty gradle plugin artifacts from mavencentral (elastic#77865) Reduce the number of times that `LifecycleExecutionState` is parsed when running a policy. (elastic#77863) Utility methods to add and remove backing indices from data streams (elastic#77778) Use Objects.equals() instead of == to compare strings (elastic#77840) [ML] prefer least allocated model when a new node is added to the cluster (elastic#77756) Deprecate ignore_throttled parameter (elastic#77479) Improve LifecycleExecutionState parsing. (elastic#77855) [DOCS] Removes deprecated word from HLRC title. (elastic#77851) Remove legacy geo code from AggregationResultUtils (elastic#77702) Adjust SearchableSnapshotsBlobStoreCacheIntegTests.testBlobStoreCache (elastic#77758) Laxify SecureSM to allow creation of the JDK's innocuous threads (elastic#77789) [Test] Reduce concurrency when testing creation of security index (elastic#75293) Refactor metric PipelineAggregation integration test (elastic#77548) ... # Conflicts: # server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
2 parents 4b3e72c + 6c4c5e2 commit 34a8e40

File tree

1,137 files changed

+24640
-10492
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,137 files changed

+24640
-10492
lines changed

.ci/jobs.t/elastic+elasticsearch+multijob+packaging-tests-unix.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- sles-15-packaging
2626
- ubuntu-18.04-packaging
2727
- ubuntu-20.04-packaging
28+
- rocky-linux-8-packaging
2829
builders:
2930
- inject:
3031
properties-file: '.ci/java-versions.properties'

.ci/jobs.t/elastic+elasticsearch+multijob+platform-support-unix.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- "sles-15&&immutable"
2626
- "ubuntu-18.04&&immutable"
2727
- "ubuntu-20.04&&immutable"
28+
- "rocky-linux-8&&immutable"
2829
builders:
2930
- inject:
3031
properties-file: '.ci/java-versions.properties'

.ci/jobs.t/elastic+elasticsearch+pull-request+packaging-tests-unix.yml

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
- sles-15-packaging
4545
- ubuntu-18.04-packaging
4646
- ubuntu-20.04-packaging
47+
- rocky-linux-8-packaging
4748
- axis:
4849
type: user-defined
4950
name: PACKAGING_TASK

.ci/jobs.t/elastic+elasticsearch+pull-request+part-1-fips.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
properties-file: '.ci/java-versions.properties'
3232
properties-content: |
3333
JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA
34-
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA
34+
RUNTIME_JAVA_HOME=$HOME/.java/java11
3535
JAVA15_HOME=$HOME/.java/openjdk15
3636
- shell: |
3737
#!/usr/local/bin/runbld --redirect-stderr

.ci/jobs.t/elastic+elasticsearch+pull-request+part-2-fips.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
properties-file: '.ci/java-versions.properties'
3232
properties-content: |
3333
JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA
34-
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA
34+
RUNTIME_JAVA_HOME=$HOME/.java/java11
3535
JAVA15_HOME=$HOME/.java/openjdk15
3636
- shell: |
3737
#!/usr/local/bin/runbld --redirect-stderr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
package org.elasticsearch.benchmark.search.fetch.subphase;
2+
3+
import org.elasticsearch.common.Strings;
4+
import org.elasticsearch.common.bytes.BytesArray;
5+
import org.elasticsearch.common.bytes.BytesReference;
6+
import org.elasticsearch.common.io.Streams;
7+
import org.elasticsearch.common.io.stream.BytesStreamOutput;
8+
import org.elasticsearch.common.xcontent.DeprecationHandler;
9+
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
10+
import org.elasticsearch.common.xcontent.XContentBuilder;
11+
import org.elasticsearch.common.xcontent.XContentParser;
12+
import org.elasticsearch.common.xcontent.XContentType;
13+
import org.elasticsearch.common.xcontent.support.filtering.FilterPath;
14+
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
15+
import org.elasticsearch.search.fetch.subphase.FetchSourcePhase;
16+
import org.elasticsearch.search.lookup.SourceLookup;
17+
import org.openjdk.jmh.annotations.Benchmark;
18+
import org.openjdk.jmh.annotations.BenchmarkMode;
19+
import org.openjdk.jmh.annotations.Fork;
20+
import org.openjdk.jmh.annotations.Measurement;
21+
import org.openjdk.jmh.annotations.Mode;
22+
import org.openjdk.jmh.annotations.OutputTimeUnit;
23+
import org.openjdk.jmh.annotations.Param;
24+
import org.openjdk.jmh.annotations.Scope;
25+
import org.openjdk.jmh.annotations.Setup;
26+
import org.openjdk.jmh.annotations.State;
27+
import org.openjdk.jmh.annotations.Warmup;
28+
29+
import java.io.IOException;
30+
import java.util.Set;
31+
import java.util.concurrent.TimeUnit;
32+
33+
@Fork(1)
34+
@Warmup(iterations = 5)
35+
@Measurement(iterations = 5)
36+
@BenchmarkMode(Mode.AverageTime)
37+
@OutputTimeUnit(TimeUnit.NANOSECONDS)
38+
@State(Scope.Benchmark)
39+
public class FetchSourcePhaseBenchmark {
40+
private BytesReference sourceBytes;
41+
private FetchSourceContext fetchContext;
42+
private Set<String> includesSet;
43+
private Set<String> excludesSet;
44+
private FilterPath[] includesFilters;
45+
private FilterPath[] excludesFilters;
46+
47+
@Param({ "tiny", "short", "one_4k_field", "one_4m_field" })
48+
private String source;
49+
@Param({ "message" })
50+
private String includes;
51+
@Param({ "" })
52+
private String excludes;
53+
54+
@Setup
55+
public void setup() throws IOException {
56+
switch (source) {
57+
case "tiny":
58+
sourceBytes = new BytesArray("{\"message\": \"short\"}");
59+
break;
60+
case "short":
61+
sourceBytes = read300BytesExample();
62+
break;
63+
case "one_4k_field":
64+
sourceBytes = buildBigExample("huge".repeat(1024));
65+
break;
66+
case "one_4m_field":
67+
sourceBytes = buildBigExample("huge".repeat(1024 * 1024));
68+
break;
69+
default:
70+
throw new IllegalArgumentException("Unknown source [" + source + "]");
71+
}
72+
fetchContext = new FetchSourceContext(
73+
true,
74+
Strings.splitStringByCommaToArray(includes),
75+
Strings.splitStringByCommaToArray(excludes)
76+
);
77+
includesSet = Set.of(fetchContext.includes());
78+
excludesSet = Set.of(fetchContext.excludes());
79+
includesFilters = FilterPath.compile(Set.of(fetchContext.includes()));
80+
excludesFilters = FilterPath.compile(Set.of(fetchContext.excludes()));
81+
}
82+
83+
private BytesReference read300BytesExample() throws IOException {
84+
return Streams.readFully(FetchSourcePhaseBenchmark.class.getResourceAsStream("300b_example.json"));
85+
}
86+
87+
private BytesReference buildBigExample(String extraText) throws IOException {
88+
String bigger = read300BytesExample().utf8ToString();
89+
bigger = "{\"huge\": \"" + extraText + "\"," + bigger.substring(1);
90+
return new BytesArray(bigger);
91+
}
92+
93+
@Benchmark
94+
public BytesReference filterObjects() throws IOException {
95+
SourceLookup lookup = new SourceLookup();
96+
lookup.setSource(sourceBytes);
97+
Object value = lookup.filter(fetchContext);
98+
return FetchSourcePhase.objectToBytes(value, XContentType.JSON, Math.min(1024, lookup.internalSourceRef().length()));
99+
}
100+
101+
@Benchmark
102+
public BytesReference filterXContentOnParser() throws IOException {
103+
BytesStreamOutput streamOutput = new BytesStreamOutput(Math.min(1024, sourceBytes.length()));
104+
XContentBuilder builder = new XContentBuilder(XContentType.JSON.xContent(), streamOutput);
105+
try (
106+
XContentParser parser = XContentType.JSON.xContent()
107+
.createParser(
108+
NamedXContentRegistry.EMPTY,
109+
DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
110+
sourceBytes.streamInput(),
111+
includesFilters,
112+
excludesFilters
113+
)
114+
) {
115+
builder.copyCurrentStructure(parser);
116+
return BytesReference.bytes(builder);
117+
}
118+
}
119+
120+
@Benchmark
121+
public BytesReference filterXContentOnBuilder() throws IOException {
122+
BytesStreamOutput streamOutput = new BytesStreamOutput(Math.min(1024, sourceBytes.length()));
123+
XContentBuilder builder = new XContentBuilder(
124+
XContentType.JSON.xContent(),
125+
streamOutput,
126+
includesSet,
127+
excludesSet,
128+
XContentType.JSON.toParsedMediaType()
129+
);
130+
try (
131+
XContentParser parser = XContentType.JSON.xContent()
132+
.createParser(NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION, sourceBytes.streamInput())
133+
) {
134+
builder.copyCurrentStructure(parser);
135+
return BytesReference.bytes(builder);
136+
}
137+
}
138+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"@timestamp": "2099-11-15T14:12:12",
3+
"http": {
4+
"request": {
5+
"method": "get"
6+
},
7+
"response": {
8+
"bytes": 1070000,
9+
"status_code": 200
10+
},
11+
"version": "1.1"
12+
},
13+
"message": "GET /search HTTP/1.1 200 1070000",
14+
"source": {
15+
"ip": "192.168.0.1"
16+
},
17+
"user": {
18+
"id": "user"
19+
}
20+
}

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/LicenseHeadersTask.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void setExcludes(List<String> excludes) {
110110
* Allowed license families for this project.
111111
*/
112112
@Input
113-
private List<String> approvedLicenses = new ArrayList<String>(Arrays.asList("SSPL+Elastic License", "Generated", "Vendored"));
113+
private List<String> approvedLicenses = new ArrayList<String>(Arrays.asList("SSPL+Elastic License", "Generated", "Vendored", "Apache LZ4-Java"));
114114
/**
115115
* Files that should be excluded from the license header check. Use with extreme care, only in situations where the license on the
116116
* source file is compatible with the codebase but we do not want to add the license to the list of approved headers (to avoid the
@@ -154,6 +154,8 @@ public void runRat() {
154154
matchers.add(subStringMatcher("BSD4 ", "Original BSD License (with advertising clause)", "All advertising materials"));
155155
// Apache
156156
matchers.add(subStringMatcher("AL ", "Apache", "Licensed to Elasticsearch B.V. under one or more contributor"));
157+
// Apache lz4-java
158+
matchers.add(subStringMatcher("ALLZ4", "Apache LZ4-Java", "Copyright 2020 Adrien Grand and the lz4-java contributors"));
157159
// Generated resources
158160
matchers.add(subStringMatcher("GEN ", "Generated", "ANTLR GENERATED CODE"));
159161
// Vendored Code

build-tools-internal/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ gradlePlugin {
102102
id = 'elasticsearch.java'
103103
implementationClass = 'org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin'
104104
}
105-
javaRestTest {
106-
id = 'elasticsearch.java-rest-test'
107-
implementationClass = 'org.elasticsearch.gradle.internal.test.rest.JavaRestTestPlugin'
105+
internalJavaRestTest {
106+
id = 'elasticsearch.internal-java-rest-test'
107+
implementationClass = 'org.elasticsearch.gradle.internal.test.rest.InternalJavaRestTestPlugin'
108108
}
109109
jdkDownload {
110110
id = 'elasticsearch.jdk-download'

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

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def projectPathsToExclude = [
5454
':libs:elasticsearch-dissect',
5555
':libs:elasticsearch-geo',
5656
':libs:elasticsearch-grok',
57+
':libs:elasticsearch-lz4',
5758
':libs:elasticsearch-nio',
5859
':libs:elasticsearch-plugin-classloader',
5960
':libs:elasticsearch-secure-sm',

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
package org.elasticsearch.gradle.internal.docker;
1010

11+
import java.util.stream.Collectors;
12+
import java.util.stream.IntStream;
13+
1114
/**
1215
* The methods in this class take a shell command and wrap it in retry logic, so that our
1316
* Docker builds can be more robust in the face of transient errors e.g. network issues.
@@ -20,7 +23,11 @@ static String loop(String name, String command) {
2023
static String loop(String name, String command, int indentSize, String exitKeyword) {
2124
String indent = " ".repeat(indentSize);
2225

23-
StringBuilder commandWithRetry = new StringBuilder("for iter in {1..10}; do \n");
26+
// bash understands the `{1..10}` syntax, but other shells don't e.g. the default in Alpine Linux.
27+
// We therefore use an explicit sequence.
28+
String retrySequence = IntStream.rangeClosed(1, 10).mapToObj(String::valueOf).collect(Collectors.joining(" "));
29+
30+
StringBuilder commandWithRetry = new StringBuilder("for iter in " + retrySequence + "; do \n");
2431
commandWithRetry.append(indent).append(" ").append(command).append(" && \n");
2532
commandWithRetry.append(indent).append(" exit_code=0 && break || \n");
2633
commandWithRetry.append(indent);

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/JavaRestTestPlugin.java renamed to build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/InternalJavaRestTestPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Apply this plugin to run the Java based REST tests.
2323
*/
24-
public class JavaRestTestPlugin implements Plugin<Project> {
24+
public class InternalJavaRestTestPlugin implements Plugin<Project> {
2525

2626
public static final String SOURCE_SET_NAME = "javaRestTest";
2727

build-tools-internal/src/main/resources/checkstyle.xml

+11
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@
9595
lines up with the directory structure. -->
9696
<module name="PackageDeclaration" />
9797

98+
<!-- Checks that a local variable or a parameter does not shadow a field that is defined in the same class. -->
99+
<!-- Disabled until existing violations are fixed -->
100+
<!--
101+
<module name="HiddenField">
102+
<property name="ignoreConstructorParameter" value="true" />
103+
<property name="ignoreSetter" value="true" />
104+
<property name="setterCanReturnItsClass" value="true"/>
105+
<property name="ignoreFormat" value="^(threadPool)$"/>
106+
</module>
107+
-->
108+
98109
<!-- We don't use Java's builtin serialization and we suppress all warning
99110
about it. The flip side of that coin is that we shouldn't _try_ to use
100111
it. We can't outright ban it with ForbiddenApis because it complain about

build-tools-internal/version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 8.0.0
2-
lucene = 8.9.0
2+
lucene = 8.10.0-snapshot-bf2fcb53079
33

44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 16.0.2+7

build-tools/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ gradlePlugin {
4646
id = 'elasticsearch.esplugin'
4747
implementationClass = 'org.elasticsearch.gradle.plugin.PluginBuildPlugin'
4848
}
49+
javaRestTest {
50+
id = 'elasticsearch.java-rest-test'
51+
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'
52+
}
4953
testclusters {
5054
id = 'elasticsearch.testclusters'
5155
implementationClass = 'org.elasticsearch.gradle.testclusters.TestClustersPlugin'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.gradle.test
10+
11+
import org.elasticsearch.gradle.VersionProperties
12+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
13+
import org.gradle.testkit.runner.TaskOutcome
14+
15+
class JavaRestTestPluginFuncTest extends AbstractGradleFuncTest {
16+
17+
def "declares default dependencies"() {
18+
given:
19+
buildFile << """
20+
plugins {
21+
id 'elasticsearch.java-rest-test'
22+
}
23+
"""
24+
25+
when:
26+
def result = gradleRunner("dependencies").build()
27+
def output = normalized(result.output)
28+
then:
29+
output.contains(normalized("""
30+
javaRestTestImplementation - Implementation only dependencies for source set 'java rest test'. (n)
31+
/--- org.elasticsearch.test:framework:${VersionProperties.elasticsearch} (n)"""))
32+
}
33+
34+
def "javaRestTest does nothing when there are no tests"() {
35+
given:
36+
buildFile << """
37+
plugins {
38+
id 'elasticsearch.java-rest-test'
39+
}
40+
41+
repositories {
42+
mavenCentral()
43+
}
44+
45+
dependencies {
46+
javaRestTestImplementation "org.elasticsearch.test:framework:7.14.0"
47+
}
48+
"""
49+
50+
when:
51+
def result = gradleRunner("javaRestTest").build()
52+
then:
53+
result.task(':compileJavaRestTestJava').outcome == TaskOutcome.NO_SOURCE
54+
result.task(':javaRestTest').outcome == TaskOutcome.NO_SOURCE
55+
}
56+
57+
}

0 commit comments

Comments
 (0)