Skip to content

Commit 3a6203f

Browse files
committed
Merge branch 'master' into feature/searchable-snapshots
# Conflicts: # plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java # plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageService.java # plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureBlobContainerRetriesTests.java # server/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java # server/src/test/java/org/elasticsearch/gateway/ReplicaShardAllocatorTests.java # x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/AsyncRetryDuringSnapshotActionStep.java # x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CopyExecutionStateStep.java # x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStep.java # x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecyclePolicy.java # x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopyExecutionStateStepTests.java
2 parents 966b363 + c495d22 commit 3a6203f

File tree

2,153 files changed

+26486
-20869
lines changed

Some content is hidden

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

2,153 files changed

+26486
-20869
lines changed

.ci/bwcVersions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ BWC_VERSION:
1717
- "7.6.0"
1818
- "7.6.1"
1919
- "7.6.2"
20+
- "7.6.3"
2021
- "7.7.0"
2122
- "7.8.0"
2223
- "8.0.0"

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.elasticsearch.Version;
2222
import org.elasticsearch.cluster.ClusterName;
2323
import org.elasticsearch.cluster.ClusterState;
24-
import org.elasticsearch.cluster.metadata.IndexMetaData;
25-
import org.elasticsearch.cluster.metadata.MetaData;
24+
import org.elasticsearch.cluster.metadata.IndexMetadata;
25+
import org.elasticsearch.cluster.metadata.Metadata;
2626
import org.elasticsearch.cluster.node.DiscoveryNodes;
2727
import org.elasticsearch.cluster.routing.RoutingTable;
2828
import org.elasticsearch.cluster.routing.ShardRoutingState;
@@ -127,27 +127,27 @@ public void setUp() throws Exception {
127127
Settings.builder().put("cluster.routing.allocation.awareness.attributes", "tag").build()
128128
);
129129

130-
MetaData.Builder mb = MetaData.builder();
130+
Metadata.Builder mb = Metadata.builder();
131131
for (int i = 1; i <= numIndices; i++) {
132132
mb.put(
133-
IndexMetaData.builder("test_" + i)
133+
IndexMetadata.builder("test_" + i)
134134
.settings(Settings.builder().put("index.version.created", Version.CURRENT))
135135
.numberOfShards(numShards)
136136
.numberOfReplicas(numReplicas)
137137
);
138138
}
139-
MetaData metaData = mb.build();
139+
Metadata metadata = mb.build();
140140
RoutingTable.Builder rb = RoutingTable.builder();
141141
for (int i = 1; i <= numIndices; i++) {
142-
rb.addAsNew(metaData.index("test_" + i));
142+
rb.addAsNew(metadata.index("test_" + i));
143143
}
144144
RoutingTable routingTable = rb.build();
145145
DiscoveryNodes.Builder nb = DiscoveryNodes.builder();
146146
for (int i = 1; i <= numNodes; i++) {
147147
nb.add(Allocators.newNode("node" + i, Collections.singletonMap("tag", "tag_" + (i % numTags))));
148148
}
149149
initialClusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
150-
.metaData(metaData)
150+
.metadata(metadata)
151151
.routingTable(routingTable)
152152
.nodes(nb)
153153
.build();

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,8 @@ subprojects {
511511
pluginManager.withPlugin('elasticsearch.testclusters') {
512512
testClusters.all {
513513
if (org.elasticsearch.gradle.info.BuildParams.isSnapshotBuild() == false) {
514-
systemProperty 'es.itv2_feature_flag_registered', 'true'
515-
systemProperty 'es.datastreams_feature_flag_registered', 'true'
514+
systemProperty 'es.itv2_feature_enabled', 'true'
515+
systemProperty 'es.datastreams_feature_enabled', 'true'
516516
}
517517
}
518518
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy

Lines changed: 0 additions & 97 deletions
This file was deleted.

buildSrc/src/main/java/org/elasticsearch/gradle/SystemPropertyCommandLineArgumentProvider.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55

66
import java.util.LinkedHashMap;
77
import java.util.Map;
8+
import java.util.function.Supplier;
89
import java.util.stream.Collectors;
910

1011
public class SystemPropertyCommandLineArgumentProvider implements CommandLineArgumentProvider {
1112
private final Map<String, Object> systemProperties = new LinkedHashMap<>();
1213

14+
public void systemProperty(String key, Supplier<String> value) {
15+
systemProperties.put(key, value);
16+
}
17+
1318
public void systemProperty(String key, Object value) {
1419
systemProperties.put(key, value);
1520
}
@@ -18,7 +23,12 @@ public void systemProperty(String key, Object value) {
1823
public Iterable<String> asArguments() {
1924
return systemProperties.entrySet()
2025
.stream()
21-
.map(entry -> "-D" + entry.getKey() + "=" + entry.getValue())
26+
.map(
27+
entry -> "-D"
28+
+ entry.getKey()
29+
+ "="
30+
+ (entry.getValue() instanceof Supplier ? ((Supplier) entry.getValue()).get() : entry.getValue())
31+
)
2232
.collect(Collectors.toList());
2333
}
2434

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/Fixture.groovy renamed to buildSrc/src/main/java/org/elasticsearch/gradle/test/Fixture.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing,
1313
* software distributed under the License is distributed on an
@@ -16,7 +16,8 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.elasticsearch.gradle.test
19+
20+
package org.elasticsearch.gradle.test;
2021

2122
/**
2223
* Any object that can produce an accompanying stop task, meant to tear down
@@ -25,6 +26,6 @@
2526
public interface Fixture {
2627

2728
/** A task which will stop this fixture. This should be used as a finalizedBy for any tasks that use the fixture. */
28-
public Object getStopTask()
29+
Object getStopTask();
2930

3031
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.gradle.test;
21+
22+
import org.elasticsearch.gradle.SystemPropertyCommandLineArgumentProvider;
23+
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
24+
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask;
25+
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
26+
import org.gradle.api.Action;
27+
import org.gradle.api.DefaultTask;
28+
import org.gradle.api.NamedDomainObjectContainer;
29+
import org.gradle.api.Project;
30+
import org.gradle.api.Task;
31+
32+
public class RestIntegTestTask extends DefaultTask {
33+
34+
protected RestTestRunnerTask runner;
35+
private static final String TESTS_REST_CLUSTER = "tests.rest.cluster";
36+
private static final String TESTS_CLUSTER = "tests.cluster";
37+
private static final String TESTS_CLUSTER_NAME = "tests.clustername";
38+
39+
public RestIntegTestTask() {
40+
Project project = getProject();
41+
String name = getName();
42+
runner = project.getTasks().create(name + "Runner", RestTestRunnerTask.class);
43+
super.dependsOn(runner);
44+
@SuppressWarnings("unchecked")
45+
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
46+
.getExtensions()
47+
.getByName(TestClustersPlugin.EXTENSION_NAME);
48+
ElasticsearchCluster cluster = testClusters.create(name);
49+
runner.useCluster(cluster);
50+
runner.include("**/*IT.class");
51+
runner.systemProperty("tests.rest.load_packaged", Boolean.FALSE.toString());
52+
if (System.getProperty(TESTS_REST_CLUSTER) == null) {
53+
if (System.getProperty(TESTS_CLUSTER) != null || System.getProperty(TESTS_CLUSTER_NAME) != null) {
54+
throw new IllegalArgumentException(
55+
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
56+
);
57+
}
58+
SystemPropertyCommandLineArgumentProvider runnerNonInputProperties = (SystemPropertyCommandLineArgumentProvider) runner
59+
.getExtensions()
60+
.getByName("nonInputProperties");
61+
runnerNonInputProperties.systemProperty(TESTS_REST_CLUSTER, () -> String.join(",", cluster.getAllHttpSocketURI()));
62+
runnerNonInputProperties.systemProperty(TESTS_CLUSTER, () -> String.join(",", cluster.getAllTransportPortURI()));
63+
runnerNonInputProperties.systemProperty(TESTS_CLUSTER_NAME, cluster::getName);
64+
} else {
65+
if (System.getProperty(TESTS_CLUSTER) == null || System.getProperty(TESTS_CLUSTER_NAME) == null) {
66+
throw new IllegalArgumentException(
67+
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
68+
);
69+
}
70+
}
71+
// this must run after all projects have been configured, so we know any project
72+
// references can be accessed as a fully configured
73+
project.getGradle().projectsEvaluated(x -> {
74+
if (isEnabled() == false) {
75+
runner.setEnabled(false);
76+
}
77+
});
78+
}
79+
80+
@Override
81+
public Task dependsOn(Object... dependencies) {
82+
runner.dependsOn(dependencies);
83+
for (Object dependency : dependencies) {
84+
if (dependency instanceof Fixture) {
85+
runner.finalizedBy(((Fixture) dependency).getStopTask());
86+
}
87+
}
88+
return this;
89+
}
90+
91+
@Override
92+
public void setDependsOn(Iterable<?> dependencies) {
93+
runner.setDependsOn(dependencies);
94+
for (Object dependency : dependencies) {
95+
if (dependency instanceof Fixture) {
96+
runner.finalizedBy(((Fixture) dependency).getStopTask());
97+
}
98+
}
99+
}
100+
101+
public void runner(Action<? super RestTestRunnerTask> configure) {
102+
configure.execute(runner);
103+
}
104+
}

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ protected SearchRequestExecutor searchRequestExecutor(RestClient client, String
6363

6464
private static final class RestBulkRequestExecutor implements BulkRequestExecutor {
6565
private final RestClient client;
66-
private final String actionMetaData;
66+
private final String actionMetadata;
6767

6868
RestBulkRequestExecutor(RestClient client, String index, String type) {
6969
this.client = client;
70-
this.actionMetaData = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
70+
this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
7171
}
7272

7373
@Override
7474
public boolean bulkIndex(List<String> bulkData) {
7575
StringBuilder bulkRequestBody = new StringBuilder();
7676
for (String bulkItem : bulkData) {
77-
bulkRequestBody.append(actionMetaData);
77+
bulkRequestBody.append(actionMetadata);
7878
bulkRequestBody.append(bulkItem);
7979
bulkRequestBody.append("\n");
8080
}

0 commit comments

Comments
 (0)