Skip to content

Commit 699cfc0

Browse files
author
Andrey Ershov
committed
Merge branch 'master' into zen2_detach_cluster
2 parents d1c3c2b + 8280a20 commit 699cfc0

File tree

239 files changed

+5928
-1285
lines changed

Some content is hidden

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

239 files changed

+5928
-1285
lines changed

.ci/packer_cache.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ while [ -h "$SCRIPT" ] ; do
1616
done
1717

1818
source $(dirname "${SCRIPT}")/java-versions.properties
19-
JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA} ./gradlew --parallel resolveAllDependencies composePull
19+
export JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA}
20+
# We are caching BWC versions too, need these so we can build those
21+
export JAVA8_HOME="${HOME}"/.java/java8
22+
export JAVA11_HOME="${HOME}"/.java/java11
23+
export JAVA12_HOME="${HOME}"/.java/java12
24+
./gradlew --parallel clean pullFixture --scan -Porg.elasticsearch.acceptScanTOS=true -s resolveAllDependencies

buildSrc/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,12 @@ if (project != rootProject) {
183183
}
184184

185185
dependencies {
186-
distribution project(':distribution:archives:zip')
187-
distribution project(':distribution:archives:oss-zip')
186+
distribution project(':distribution:archives:windows-zip')
187+
distribution project(':distribution:archives:oss-windows-zip')
188+
distribution project(':distribution:archives:darwin-tar')
189+
distribution project(':distribution:archives:oss-darwin-tar')
190+
distribution project(':distribution:archives:linux-tar')
191+
distribution project(':distribution:archives:oss-linux-tar')
188192
}
189193

190194
String localDownloads = "${rootProject.buildDir}/local-downloads"

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

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,38 @@ class ClusterFormationTasks {
191191
throw new GradleException("Unknown distribution: ${distro} in project ${project.path}")
192192
}
193193
Version version = Version.fromString(elasticsearchVersion)
194-
String group = "downloads.zip" // dummy group, does not matter except for integ-test-zip, it is ignored by the fake ivy repo
194+
String os = getOs()
195+
String classifier = "${os}-x86_64"
196+
String packaging = os.equals('windows') ? 'zip' : 'tar.gz'
195197
String artifactName = 'elasticsearch'
196198
if (distro.equals('oss') && Version.fromString(elasticsearchVersion).onOrAfter('6.3.0')) {
197199
artifactName += '-oss'
198200
}
199-
String snapshotProject = distro == 'oss' ? 'oss-zip' : 'zip'
200201
Object dependency
202+
String snapshotProject = "${os}-${os.equals('windows') ? 'zip' : 'tar'}"
203+
if (version.before("7.0.0")) {
204+
snapshotProject = "zip"
205+
}
206+
if (distro.equals("oss")) {
207+
snapshotProject = "oss-" + snapshotProject
208+
}
201209
boolean internalBuild = project.hasProperty('bwcVersions')
202210
VersionCollection.UnreleasedVersionInfo unreleasedInfo = null
203211
if (project.hasProperty('bwcVersions')) {
204212
// NOTE: leniency is needed for external plugin authors using build-tools. maybe build the version compat info into build-tools?
205213
unreleasedInfo = project.bwcVersions.unreleasedInfo(version)
206214
}
207215
if (unreleasedInfo != null) {
208-
dependency = project.dependencies.project(path: ":distribution:bwc:${unreleasedInfo.gradleProjectName}", configuration: snapshotProject)
216+
dependency = project.dependencies.project(
217+
path: ":distribution:bwc:${unreleasedInfo.gradleProjectName}", configuration: snapshotProject)
209218
} else if (internalBuild && elasticsearchVersion.equals(VersionProperties.elasticsearch)) {
210219
dependency = project.dependencies.project(path: ":distribution:archives:${snapshotProject}")
211220
} else {
212-
dependency = "${group}:${artifactName}:${elasticsearchVersion}@zip"
221+
if (version.before('7.0.0')) {
222+
classifier = "" // for bwc, before we had classifiers
223+
}
224+
// group does not matter as it is not used when we pull from the ivy repo that points to the download service
225+
dependency = "dnm:${artifactName}:${elasticsearchVersion}${classifier}@${packaging}"
213226
}
214227
project.dependencies.add(configuration.name, dependency)
215228
}
@@ -335,8 +348,15 @@ class ClusterFormationTasks {
335348
the elasticsearch source tree then this should be the version of elasticsearch built by the source tree.
336349
If it isn't then Bad Things(TM) will happen. */
337350
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
338-
from {
339-
project.zipTree(configuration.singleFile)
351+
if (getOs().equals("windows")) {
352+
from {
353+
project.zipTree(configuration.singleFile)
354+
}
355+
} else {
356+
// macos and linux use tar
357+
from {
358+
project.tarTree(project.resources.gzip(configuration.singleFile))
359+
}
340360
}
341361
into node.baseDir
342362
}
@@ -948,4 +968,15 @@ class ClusterFormationTasks {
948968
PluginPropertiesExtension extension = pluginProject.extensions.findByName('esplugin')
949969
return extension.name
950970
}
971+
972+
/** Find the current OS */
973+
static String getOs() {
974+
String os = "linux"
975+
if (Os.FAMILY_WINDOWS) {
976+
os = "windows"
977+
} else if (Os.FAMILY_MAC) {
978+
os = "darwin"
979+
}
980+
return os
981+
}
951982
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class VagrantTestPlugin implements Plugin<Project> {
5353

5454
/** All distributions to bring into test VM, whether or not they are used **/
5555
static final List<String> DISTRIBUTIONS = unmodifiableList([
56-
'archives:tar',
57-
'archives:oss-tar',
58-
'archives:zip',
59-
'archives:oss-zip',
56+
'archives:linux-tar',
57+
'archives:oss-linux-tar',
58+
'archives:windows-zip',
59+
'archives:oss-windows-zip',
6060
'packages:rpm',
6161
'packages:oss-rpm',
6262
'packages:deb',

buildSrc/src/main/java/org/elasticsearch/gradle/testfixtures/TestFixturesPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ public void apply(Project project) {
5959
disableTaskByType(tasks, JarHellTask.class);
6060

6161
Task buildFixture = project.getTasks().create("buildFixture");
62+
Task pullFixture = project.getTasks().create("pullFixture");
6263
Task preProcessFixture = project.getTasks().create("preProcessFixture");
6364
buildFixture.dependsOn(preProcessFixture);
65+
pullFixture.dependsOn(preProcessFixture);
6466
Task postProcessFixture = project.getTasks().create("postProcessFixture");
6567

6668
if (dockerComposeSupported(project) == false) {
6769
preProcessFixture.setEnabled(false);
6870
postProcessFixture.setEnabled(false);
6971
buildFixture.setEnabled(false);
72+
pullFixture.setEnabled(false);
7073
return;
7174
}
7275

@@ -81,7 +84,9 @@ public void apply(Project project) {
8184
);
8285

8386
buildFixture.dependsOn(tasks.getByName("composeUp"));
87+
pullFixture.dependsOn(tasks.getByName("composePull"));
8488
tasks.getByName("composeUp").mustRunAfter(preProcessFixture);
89+
tasks.getByName("composePull").mustRunAfter(preProcessFixture);
8590
postProcessFixture.dependsOn(buildFixture);
8691

8792
configureServiceInfoForTask(

client/rest-high-level/src/main/java/org/elasticsearch/client/CcrRequestConverters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static Request putFollow(PutFollowRequest putFollowRequest) throws IOException {
4646
.addPathPartAsIs("_ccr", "follow")
4747
.build();
4848
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
49+
RequestConverters.Params parameters = new RequestConverters.Params(request);
50+
parameters.withWaitForActiveShards(putFollowRequest.waitForActiveShards());
4951
request.setEntity(createEntity(putFollowRequest, REQUEST_BODY_CONTENT_TYPE));
5052
return request;
5153
}

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
5050
import org.elasticsearch.action.admin.indices.shrink.ResizeResponse;
5151
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
52-
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
53-
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
5452
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
5553
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
5654
import org.elasticsearch.action.support.master.AcknowledgedResponse;
@@ -61,7 +59,9 @@
6159
import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
6260
import org.elasticsearch.client.indices.GetMappingsRequest;
6361
import org.elasticsearch.client.indices.GetMappingsResponse;
62+
import org.elasticsearch.client.indices.GetIndexTemplatesResponse;
6463
import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
64+
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
6565
import org.elasticsearch.client.indices.PutMappingRequest;
6666
import org.elasticsearch.client.indices.UnfreezeIndexRequest;
6767
import org.elasticsearch.rest.RestStatus;
@@ -908,6 +908,7 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
908908
AcknowledgedResponse::fromXContent, listener, emptySet());
909909
}
910910

911+
911912
/**
912913
* Puts an index template using the Index Templates API.
913914
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
@@ -916,9 +917,13 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
916917
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
917918
* @return the response
918919
* @throws IOException in case there is a problem sending the request or parsing back the response
920+
* @deprecated This old form of request allows types in mappings. Use {@link #putTemplate(PutIndexTemplateRequest, RequestOptions)}
921+
* instead which introduces a new request object without types.
919922
*/
920-
public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest,
921-
RequestOptions options) throws IOException {
923+
@Deprecated
924+
public AcknowledgedResponse putTemplate(
925+
org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
926+
RequestOptions options) throws IOException {
922927
return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
923928
AcknowledgedResponse::fromXContent, emptySet());
924929
}
@@ -930,9 +935,44 @@ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplate
930935
* @param putIndexTemplateRequest the request
931936
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
932937
* @param listener the listener to be notified upon request completion
938+
* @deprecated This old form of request allows types in mappings.
939+
* Use {@link #putTemplateAsync(PutIndexTemplateRequest, RequestOptions, ActionListener)}
940+
* instead which introduces a new request object without types.
933941
*/
934-
public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options,
935-
ActionListener<AcknowledgedResponse> listener) {
942+
@Deprecated
943+
public void putTemplateAsync(org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
944+
RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
945+
restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
946+
AcknowledgedResponse::fromXContent, listener, emptySet());
947+
}
948+
949+
950+
/**
951+
* Puts an index template using the Index Templates API.
952+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
953+
* on elastic.co</a>
954+
* @param putIndexTemplateRequest the request
955+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
956+
* @return the response
957+
* @throws IOException in case there is a problem sending the request or parsing back the response
958+
*/
959+
public AcknowledgedResponse putTemplate(
960+
PutIndexTemplateRequest putIndexTemplateRequest,
961+
RequestOptions options) throws IOException {
962+
return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
963+
AcknowledgedResponse::fromXContent, emptySet());
964+
}
965+
966+
/**
967+
* Asynchronously puts an index template using the Index Templates API.
968+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
969+
* on elastic.co</a>
970+
* @param putIndexTemplateRequest the request
971+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
972+
* @param listener the listener to be notified upon request completion
973+
*/
974+
public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest,
975+
RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
936976
restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
937977
AcknowledgedResponse::fromXContent, listener, emptySet());
938978
}
@@ -968,33 +1008,74 @@ public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, Reques
9681008
}
9691009

9701010
/**
971-
* Gets index templates using the Index Templates API
1011+
* Gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format, where the
1012+
* mapping definition is nested under the type name.
9721013
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
9731014
* on elastic.co</a>
9741015
* @param getIndexTemplatesRequest the request
9751016
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
9761017
* @return the response
9771018
* @throws IOException in case there is a problem sending the request or parsing back the response
1019+
* @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1020+
* {@link #getIndexTemplate(GetIndexTemplatesRequest, RequestOptions)} instead which returns a new response object
9781021
*/
979-
public GetIndexTemplatesResponse getTemplate(GetIndexTemplatesRequest getIndexTemplatesRequest,
980-
RequestOptions options) throws IOException {
981-
return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest, IndicesRequestConverters::getTemplates,
982-
options, GetIndexTemplatesResponse::fromXContent, emptySet());
1022+
@Deprecated
1023+
public org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse getTemplate(
1024+
GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options) throws IOException {
1025+
return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest,
1026+
IndicesRequestConverters::getTemplatesWithDocumentTypes,
1027+
options, org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse::fromXContent, emptySet());
9831028
}
1029+
1030+
/**
1031+
* Gets index templates using the Index Templates API
1032+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1033+
* on elastic.co</a>
1034+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1035+
* @param getIndexTemplatesRequest the request
1036+
* @return the response
1037+
* @throws IOException in case there is a problem sending the request or parsing back the response
1038+
*/
1039+
public GetIndexTemplatesResponse getIndexTemplate(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options)
1040+
throws IOException {
1041+
return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest,
1042+
IndicesRequestConverters::getTemplates,
1043+
options, GetIndexTemplatesResponse::fromXContent, emptySet());
1044+
}
9841045

9851046
/**
986-
* Asynchronously gets index templates using the Index Templates API
1047+
* Asynchronously gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format,
1048+
* where the mapping definition is nested under the type name.
9871049
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
9881050
* on elastic.co</a>
9891051
* @param getIndexTemplatesRequest the request
9901052
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
9911053
* @param listener the listener to be notified upon request completion
1054+
* @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1055+
* {@link #getIndexTemplateAsync(GetIndexTemplatesRequest, RequestOptions, ActionListener)} instead which returns a new response object
9921056
*/
1057+
@Deprecated
9931058
public void getTemplateAsync(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options,
1059+
ActionListener<org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse> listener) {
1060+
restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest,
1061+
IndicesRequestConverters::getTemplatesWithDocumentTypes,
1062+
options, org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse::fromXContent, listener, emptySet());
1063+
}
1064+
1065+
/**
1066+
* Asynchronously gets index templates using the Index Templates API
1067+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1068+
* on elastic.co</a>
1069+
* @param getIndexTemplatesRequest the request
1070+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1071+
* @param listener the listener to be notified upon request completion
1072+
*/
1073+
public void getIndexTemplateAsync(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options,
9941074
ActionListener<GetIndexTemplatesResponse> listener) {
995-
restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest, IndicesRequestConverters::getTemplates,
1075+
restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest,
1076+
IndicesRequestConverters::getTemplates,
9961077
options, GetIndexTemplatesResponse::fromXContent, listener, emptySet());
997-
}
1078+
}
9981079

9991080
/**
10001081
* Uses the Index Templates API to determine if index templates exist

0 commit comments

Comments
 (0)