Skip to content

Commit 4785696

Browse files
committed
Merge branch '6.x' into ccr-6.x
* 6.x: Upgrade to Lucene-7.4-snapshot-6705632810 (#30519) Remove Discovery.AckListener.onTimeout() (#30514) Build: move generated-resources to build (#30366) Reindex: Fold "with all deps" project into reindex (#30154) Isolate REST client single host tests (#30504) Remove BWC repository test (#30500) Build: Remove xpack specific run task (#30487) AwaitsFix IntegTestZipClientYamlTestSuiteIT#indices.split tests LLClient: Add setJsonEntity (#30447) [docs] add warning for read-write indices in force merge documentation (#28869) Avoid deadlocks in cache (#30461) BulkProcessor to retry based on status code (#29329) Avoid setting connection request timeout (#30384) Test: remove hardcoded list of unconfigured ciphers (#30367) Add GET Repository High Level REST API (#30362) mute SplitIndexIT due to #30416 Docs: Test examples that recreate lang analyzers (#29535) add a comment explaining the need for RetryOnReplicaException on missing mappings Pass the task to broadcast actions (#29672) Stop forking groovyc (#30471) Add `coordinating_only` node selector (#30313) Fix accidental error in changelog Use date format in `date_range` mapping before fallback to default (#29310) Watcher: Increase HttpClient parallel sent requests (#30130) [Security][Tests] Azeri(Turkish) locale tripps opensaml dependency
2 parents 97b9d2b + e06e608 commit 4785696

File tree

196 files changed

+1578
-748
lines changed

Some content is hidden

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

196 files changed

+1578
-748
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,15 @@ class BuildPlugin implements Plugin<Project> {
535535
}
536536
// also apply release flag to groovy, which is used in build-tools
537537
project.tasks.withType(GroovyCompile) {
538-
final JavaVersion targetCompatibilityVersion = JavaVersion.toVersion(it.targetCompatibility)
539-
options.fork = true
540-
options.forkOptions.javaHome = new File(project.compilerJavaHome)
541-
options.compilerArgs << '--release' << targetCompatibilityVersion.majorVersion
538+
final compilerJavaHomeFile = new File(project.compilerJavaHome)
539+
// we only fork if the Gradle JDK is not the same as the compiler JDK
540+
if (compilerJavaHomeFile.canonicalPath == Jvm.current().javaHome.canonicalPath) {
541+
options.fork = false
542+
} else {
543+
options.fork = true
544+
options.forkOptions.javaHome = compilerJavaHomeFile
545+
options.compilerArgs << '--release' << JavaVersion.toVersion(it.targetCompatibility).majorVersion
546+
}
542547
}
543548
}
544549
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
141141
private static final String SYNTAX = {
142142
String method = /(?<method>GET|PUT|POST|HEAD|OPTIONS|DELETE)/
143143
String pathAndQuery = /(?<pathAndQuery>[^\n]+)/
144-
String badBody = /GET|PUT|POST|HEAD|OPTIONS|DELETE|#/
144+
String badBody = /GET|PUT|POST|HEAD|OPTIONS|DELETE|startyaml|#/
145145
String body = /(?<body>(?:\n(?!$badBody)[^\n]+)+)/
146-
String nonComment = /$method\s+$pathAndQuery$body?/
146+
String rawRequest = /(?:$method\s+$pathAndQuery$body?)/
147+
String yamlRequest = /(?:startyaml(?s)(?<yaml>.+?)(?-s)endyaml)/
148+
String nonComment = /(?:$rawRequest|$yamlRequest)/
147149
String comment = /(?<comment>#.+)/
148150
/(?:$comment|$nonComment)\n+/
149151
}()
@@ -333,6 +335,11 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
333335
// Comment
334336
return
335337
}
338+
String yamlRequest = matcher.group("yaml");
339+
if (yamlRequest != null) {
340+
current.println(yamlRequest)
341+
return
342+
}
336343
String method = matcher.group("method")
337344
String pathAndQuery = matcher.group("pathAndQuery")
338345
String body = matcher.group("body")

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 6.4.0
2-
lucene = 7.4.0-snapshot-1ed95c097b
2+
lucene = 7.4.0-snapshot-6705632810
33

44
# optional dependencies
55
spatial4j = 0.7

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.http.entity.ContentType;
3030
import org.apache.lucene.util.BytesRef;
3131
import org.elasticsearch.action.DocWriteRequest;
32+
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
3233
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
3334
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
3435
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
@@ -626,6 +627,17 @@ static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) thr
626627
return request;
627628
}
628629

630+
static Request getRepositories(GetRepositoriesRequest getRepositoriesRequest) {
631+
String[] repositories = getRepositoriesRequest.repositories() == null ? Strings.EMPTY_ARRAY : getRepositoriesRequest.repositories();
632+
String endpoint = new EndpointBuilder().addPathPartAsIs("_snapshot").addCommaSeparatedPathParts(repositories).build();
633+
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
634+
635+
Params parameters = new Params(request);
636+
parameters.withMasterTimeout(getRepositoriesRequest.masterNodeTimeout());
637+
parameters.withLocal(getRepositoriesRequest.local());
638+
return request;
639+
}
640+
629641
static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) throws IOException {
630642
String endpoint = new EndpointBuilder().addPathPartAsIs("_template").addPathPart(putIndexTemplateRequest.name()).build();
631643
Request request = new Request(HttpPut.METHOD_NAME, endpoint);

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.elasticsearch.action.ActionListener;
2727
import org.elasticsearch.action.ActionRequest;
2828
import org.elasticsearch.action.ActionRequestValidationException;
29+
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
30+
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
2931
import org.elasticsearch.action.bulk.BulkRequest;
3032
import org.elasticsearch.action.bulk.BulkResponse;
3133
import org.elasticsearch.action.delete.DeleteRequest;
@@ -187,6 +189,7 @@ public class RestHighLevelClient implements Closeable {
187189

188190
private final IndicesClient indicesClient = new IndicesClient(this);
189191
private final ClusterClient clusterClient = new ClusterClient(this);
192+
private final SnapshotClient snapshotClient = new SnapshotClient(this);
190193

191194
/**
192195
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -250,6 +253,15 @@ public final ClusterClient cluster() {
250253
return clusterClient;
251254
}
252255

256+
/**
257+
* Provides a {@link SnapshotClient} which can be used to access the Snapshot API.
258+
*
259+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html">Snapshot API on elastic.co</a>
260+
*/
261+
public final SnapshotClient snapshot() {
262+
return snapshotClient;
263+
}
264+
253265
/**
254266
* Executes a bulk request using the Bulk API
255267
*
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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.client;
21+
22+
import org.apache.http.Header;
23+
import org.elasticsearch.action.ActionListener;
24+
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
25+
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
26+
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
27+
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
28+
29+
import java.io.IOException;
30+
31+
import static java.util.Collections.emptySet;
32+
33+
/**
34+
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Snapshot API.
35+
* <p>
36+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html">Snapshot API on elastic.co</a>
37+
*/
38+
public final class SnapshotClient {
39+
private final RestHighLevelClient restHighLevelClient;
40+
41+
SnapshotClient(RestHighLevelClient restHighLevelClient) {
42+
this.restHighLevelClient = restHighLevelClient;
43+
}
44+
45+
/**
46+
* Gets a list of snapshot repositories. If the list of repositories is empty or it contains a single element "_all", all
47+
* registered repositories are returned.
48+
* <p>
49+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html"> Snapshot and Restore
50+
* API on elastic.co</a>
51+
*/
52+
public GetRepositoriesResponse getRepositories(GetRepositoriesRequest getRepositoriesRequest, Header... headers)
53+
throws IOException {
54+
return restHighLevelClient.performRequestAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories,
55+
GetRepositoriesResponse::fromXContent, emptySet(), headers);
56+
}
57+
58+
/**
59+
* Asynchronously gets a list of snapshot repositories. If the list of repositories is empty or it contains a single element "_all", all
60+
* registered repositories are returned.
61+
* <p>
62+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html"> Snapshot and Restore
63+
* API on elastic.co</a>
64+
*/
65+
public void getRepositoriesAsync(GetRepositoriesRequest getRepositoriesRequest,
66+
ActionListener<GetRepositoriesResponse> listener, Header... headers) {
67+
restHighLevelClient.performRequestAsyncAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories,
68+
GetRepositoriesResponse::fromXContent, listener, emptySet(), headers);
69+
}
70+
}

0 commit comments

Comments
 (0)