Skip to content

Commit a5be414

Browse files
committed
Merge branch 'master' into ccr
* master: Upgrade to Lucene-7.4-snapshot-6705632810 (#30519) add version compatibility from 6.4.0 after backport, see #30319 (#30390) Security: Simplify security index listeners (#30466) Add proper longitude validation in geo_polygon_query (#30497) 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) Solve Gradle deprecation warnings around shadowJar (#30483) SAML: Process only signed data (#30420) Remove BWC repository test (#30500) Build: Remove xpack specific run task (#30487) AwaitsFix IntegTestZipClientYamlTestSuiteIT#indices.split tests LLClient: Add setJsonEntity (#30447) Expose CommonStatsFlags directly in IndicesStatsRequest. (#30163) Silence IndexUpgradeIT test failures. (#30430) Bump Gradle heap to 1792m (#30484) [docs] add warning for read-write indices in force merge documentation (#28869) Avoid deadlocks in cache (#30461) Test: remove hardcoded list of unconfigured ciphers (#30367) mute SplitIndexIT due to #30416 Docs: Test examples that recreate lang analyzers (#29535) BulkProcessor to retry based on status code (#29329) Add GET Repository High Level REST API (#30362) add a comment explaining the need for RetryOnReplicaException on missing mappings Add `coordinating_only` node selector (#30313) Stop forking groovyc (#30471) Avoid setting connection request timeout (#30384) Use date format in `date_range` mapping before fallback to default (#29310) Watcher: Increase HttpClient parallel sent requests (#30130) # Conflicts: # x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/LocalStateCompositeXPackPlugin.java
2 parents 441c47f + 519768b commit a5be414

File tree

231 files changed

+2050
-1435
lines changed

Some content is hidden

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

231 files changed

+2050
-1435
lines changed

benchmarks/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ buildscript {
2424
}
2525
}
2626
dependencies {
27-
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
27+
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
2828
}
2929
}
3030

3131
apply plugin: 'elasticsearch.build'
32-
// build an uberjar with all benchmarks
33-
apply plugin: 'com.github.johnrengelman.shadow'
34-
// have the shadow plugin provide the runShadow task
35-
apply plugin: 'application'
32+
33+
// order of this seciont matters, see: https://github.com/johnrengelman/shadow/issues/336
34+
apply plugin: 'application' // have the shadow plugin provide the runShadow task
35+
mainClassName = 'org.openjdk.jmh.Main'
36+
apply plugin: 'com.github.johnrengelman.shadow' // build an uberjar with all benchmarks
3637

3738
// Not published so no need to assemble
3839
tasks.remove(assemble)
3940
build.dependsOn.remove('assemble')
4041

4142
archivesBaseName = 'elasticsearch-benchmarks'
42-
mainClassName = 'org.openjdk.jmh.Main'
4343

4444
test.enabled = false
4545

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 = 7.0.0-alpha1
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;
@@ -644,6 +645,17 @@ static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) thr
644645
return request;
645646
}
646647

648+
static Request getRepositories(GetRepositoriesRequest getRepositoriesRequest) {
649+
String[] repositories = getRepositoriesRequest.repositories() == null ? Strings.EMPTY_ARRAY : getRepositoriesRequest.repositories();
650+
String endpoint = new EndpointBuilder().addPathPartAsIs("_snapshot").addCommaSeparatedPathParts(repositories).build();
651+
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
652+
653+
Params parameters = new Params(request);
654+
parameters.withMasterTimeout(getRepositoriesRequest.masterNodeTimeout());
655+
parameters.withLocal(getRepositoriesRequest.local());
656+
return request;
657+
}
658+
647659
static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) throws IOException {
648660
String endpoint = new EndpointBuilder().addPathPartAsIs("_template").addPathPart(putIndexTemplateRequest.name()).build();
649661
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;
@@ -189,6 +191,7 @@ public class RestHighLevelClient implements Closeable {
189191

190192
private final IndicesClient indicesClient = new IndicesClient(this);
191193
private final ClusterClient clusterClient = new ClusterClient(this);
194+
private final SnapshotClient snapshotClient = new SnapshotClient(this);
192195

193196
/**
194197
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -252,6 +255,15 @@ public final ClusterClient cluster() {
252255
return clusterClient;
253256
}
254257

258+
/**
259+
* Provides a {@link SnapshotClient} which can be used to access the Snapshot API.
260+
*
261+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html">Snapshot API on elastic.co</a>
262+
*/
263+
public final SnapshotClient snapshot() {
264+
return snapshotClient;
265+
}
266+
255267
/**
256268
* Executes a bulk request using the Bulk API
257269
*
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)