Skip to content

Commit 144e0f4

Browse files
committed
Merge branch 'master' into 2019-10-23-handle-negative-free-space
2 parents eaa7bab + af59a67 commit 144e0f4

File tree

270 files changed

+5141
-3586
lines changed

Some content is hidden

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

270 files changed

+5141
-3586
lines changed

.ci/os.ps1

+4-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
55
exit
66
}
77

8-
# CI configures these, uncoment if running manually
9-
#
10-
# $env:ES_BUILD_JAVA="java12"
11-
#$env:ES_RUNTIME_JAVA="java11"
8+
$AppProps = ConvertFrom-StringData (Get-Content .ci/java-versions.properties -raw)
9+
$env:ES_BUILD_JAVA=$AppProps.ES_BUILD_JAVA
10+
$env:ES_RUNTIME_JAVA=$AppProps.ES_RUNTIME_JAVA
1211

1312
$ErrorActionPreference="Stop"
1413
$gradleInit = "C:\Users\$env:username\.gradle\init.d\"
@@ -27,10 +26,6 @@ New-Item -ItemType directory -Path \tmp
2726

2827
$ErrorActionPreference="Continue"
2928
# TODO: remove the task exclusions once dependencies are set correctly and these don't run for Windows or buldiung the deb on windows is fixed
30-
& .\gradlew.bat -g "C:\Users\$env:username\.gradle" --parallel --scan --console=plain destructiveDistroTest `
31-
-x :distribution:packages:buildOssDeb `
32-
-x :distribution:packages:buildDeb `
33-
-x :distribution:packages:buildOssRpm `
34-
-x :distribution:packages:buildRpm `
29+
& .\gradlew.bat -g "C:\Users\$env:username\.gradle" --parallel --scan --console=plain destructiveDistroTest
3530

3631
exit $LastExitCode

TESTING.asciidoc

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ supports a remote debugging option:
4343
./gradlew run --debug-jvm
4444
---------------------------------------------------------------------------
4545

46+
This will instruct all JVMs (including any that run cli tools such as creating the keyring or adding users)
47+
to suspend and initiate a debug connection on port incrementing from `5005`.
48+
As such the IDE needs to be instructed to listen for connections on this port.
49+
Since we might run multiple JVMs as part of configuring and starting the cluster it's
50+
recommended to have the option to aut restart checked.
51+
4652
==== Distribution
4753

4854
By default a node is started with the zip distribution.

buildSrc/reaper/src/main/java/org/elasticsearch/gradle/reaper/Reaper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Since how to reap a given service is platform and service dependent, this tool
3838
* operates on system commands to execute. It takes a single argument, a directory
3939
* that will contain files with reaping commands. Each line in each file will be
40-
* executed with {@link Runtime#getRuntime()#exec}.
40+
* executed with {@link Runtime#exec(String)}.
4141
*
4242
* The main method will wait indefinitely on the parent process (Gradle) by
4343
* reading from stdin. When Gradle shuts down, whether normally or abruptly, the

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ class BuildPlugin implements Plugin<Project> {
676676
*/
677677
(javadoc.options as CoreJavadocOptions).addBooleanOption('html5', true)
678678
}
679+
// ensure javadoc task is run with 'check'
680+
project.pluginManager.withPlugin('lifecycle-base') {
681+
project.tasks.getByName(LifecycleBasePlugin.CHECK_TASK_NAME).dependsOn(project.tasks.withType(Javadoc))
682+
}
679683
configureJavadocJar(project)
680684
}
681685

@@ -857,6 +861,9 @@ class BuildPlugin implements Plugin<Project> {
857861
'tests.security.manager': 'true',
858862
'jna.nosys': 'true'
859863

864+
//TODO remove once jvm.options are added to test system properties
865+
test.systemProperty ('java.locale.providers','SPI,COMPAT')
866+
860867
// ignore changing test seed when build is passed -Dignore.tests.seed for cacheability experimentation
861868
if (System.getProperty('ignore.tests.seed') != null) {
862869
nonInputProperties.systemProperty('tests.seed', project.property('testSeed'))
@@ -889,7 +896,6 @@ class BuildPlugin implements Plugin<Project> {
889896
test.systemProperty('io.netty.noUnsafe', 'true')
890897
test.systemProperty('io.netty.noKeySetOptimization', 'true')
891898
test.systemProperty('io.netty.recycler.maxCapacityPerThread', '0')
892-
test.systemProperty('io.netty.allocator.numDirectArenas', '0')
893899

894900
test.testLogging { TestLoggingContainer logging ->
895901
logging.showExceptions = true

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/DistroTestPlugin.java

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import java.util.Map;
6060
import java.util.Random;
6161
import java.util.stream.Collectors;
62+
import java.util.stream.Stream;
6263

6364
import static org.elasticsearch.gradle.vagrant.VagrantMachine.convertLinuxPath;
6465
import static org.elasticsearch.gradle.vagrant.VagrantMachine.convertWindowsPath;
@@ -187,6 +188,12 @@ private static List<Object> configureVM(Project project) {
187188
vagrant.setBox(box);
188189
vagrant.vmEnv("SYSTEM_JAVA_HOME", convertPath(project, vagrant, systemJdk, "", ""));
189190
vagrant.vmEnv("PATH", convertPath(project, vagrant, gradleJdk, "/bin:$PATH", "\\bin;$Env:PATH"));
191+
// pass these along to get correct build scans
192+
if (System.getenv("JENKINS_URL") != null) {
193+
Stream.of("JOB_NAME", "JENKINS_URL", "BUILD_NUMBER", "BUILD_URL").forEach(name ->
194+
vagrant.vmEnv(name, System.getenv(name))
195+
);
196+
}
190197
vagrant.setIsWindowsVM(isWindows(project));
191198

192199
return Arrays.asList(systemJdk, gradleJdk);

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

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
2424
import org.elasticsearch.gradle.tool.Boilerplate
2525
import org.elasticsearch.gradle.tool.ClasspathUtils
2626
import org.gradle.api.DefaultTask
27+
import org.gradle.api.JavaVersion
2728
import org.gradle.api.Task
2829
import org.gradle.api.file.FileCopyDetails
2930
import org.gradle.api.tasks.Copy

buildSrc/src/main/java/org/elasticsearch/gradle/precommit/JarHellTask.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public JarHellTask() {
4242
@TaskAction
4343
public void runJarHellCheck() {
4444
LoggedExec.javaexec(getProject(), spec -> {
45-
spec.classpath(getClasspath());
45+
spec.environment("CLASSPATH", getClasspath().getAsPath());
4646
spec.setMain("org.elasticsearch.bootstrap.JarHell");
4747
});
4848
}

buildSrc/src/main/java/org/elasticsearch/gradle/test/GradleDistroTestTask.java

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private List<String> getScript(boolean isWindows) {
8080
line.append(" --project-cache-dir ");
8181
line.append(isWindows ? convertWindowsPath(getProject(), cacheDir) : convertLinuxPath(getProject(), cacheDir));
8282
line.append(" -S");
83+
line.append(" --parallel");
8384
line.append(" -D'org.gradle.logging.level'=" + getProject().getGradle().getStartParameter().getLogLevel());
8485
if (testClass != null) {
8586
line.append(" --tests=");

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/RunTask.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public Boolean getDebug() {
3636

3737
@Override
3838
public void beforeStart() {
39-
int debugPort = 8000;
39+
int debugPort = 5005;
4040
int httpPort = 9200;
4141
int transportPort = 9300;
4242
Map<String, String> additionalSettings = System.getProperties().entrySet().stream()
@@ -57,7 +57,7 @@ public void beforeStart() {
5757
"Running elasticsearch in debug mode, {} suspending until connected on debugPort {}",
5858
node, debugPort
5959
);
60-
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=" + debugPort);
60+
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=" + debugPort);
6161
debugPort += 1;
6262
}
6363
}

client/rest-high-level/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,11 @@ testClusters.integTest {
129129

130130
setting 'indices.lifecycle.poll_interval', '1000ms'
131131
keystore 'xpack.security.transport.ssl.truststore.secure_password', 'testnode'
132+
extraConfigFile 'roles.yml', file('roles.yml')
132133
user username: System.getProperty('tests.rest.cluster.username', 'test_user'),
133-
password: System.getProperty('tests.rest.cluster.password', 'test-password')
134+
password: System.getProperty('tests.rest.cluster.password', 'test-password'),
135+
role: System.getProperty('tests.rest.cluster.role', 'admin')
136+
user username: 'admin_user', password: 'admin-password'
134137

135138
extraConfigFile nodeCert.name, nodeCert
136139
extraConfigFile nodeTrustStore.name, nodeTrustStore

client/rest-high-level/roles.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
admin:
2+
cluster:
3+
- all
4+
indices:
5+
- names: '*'
6+
privileges:
7+
- all
8+
run_as: [ '*' ]
9+
applications:
10+
- application: '*'
11+
privileges: [ '*' ]
12+
resources: [ '*' ]

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

-85
Original file line numberDiff line numberDiff line change
@@ -297,55 +297,6 @@ public Cancellable getMappingAsync(GetMappingsRequest getMappingsRequest, Reques
297297
emptySet());
298298
}
299299

300-
/**
301-
* Retrieves the mappings on an index or indices using the Get Mapping API.
302-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html">
303-
* Get Mapping API on elastic.co</a>
304-
* @param getMappingsRequest the request
305-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
306-
* @return the response
307-
* @throws IOException in case there is a problem sending the request or parsing back the response
308-
*
309-
* @deprecated This method uses old request and response objects which still refer to types, a deprecated
310-
* feature. The method {@link #getMapping(GetMappingsRequest, RequestOptions)} should be used instead, which
311-
* accepts a new request object.
312-
*/
313-
@Deprecated
314-
public org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse getMapping(
315-
org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
316-
RequestOptions options) throws IOException {
317-
return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest,
318-
IndicesRequestConverters::getMappings,
319-
options,
320-
org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse::fromXContent,
321-
emptySet());
322-
}
323-
324-
/**
325-
* Asynchronously retrieves the mappings on an index on indices using the Get Mapping API.
326-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html">
327-
* Get Mapping API on elastic.co</a>
328-
* @param getMappingsRequest the request
329-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
330-
* @param listener the listener to be notified upon request completion
331-
*
332-
* @deprecated This method uses old request and response objects which still refer to types, a deprecated feature.
333-
* The method {@link #getMapping(GetMappingsRequest, RequestOptions)} should be used instead, which accepts a new
334-
* request object.
335-
* @return cancellable that may be used to cancel the request
336-
*/
337-
@Deprecated
338-
public Cancellable getMappingAsync(org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
339-
RequestOptions options,
340-
ActionListener<org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse> listener) {
341-
return restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest,
342-
IndicesRequestConverters::getMappings,
343-
options,
344-
org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse::fromXContent,
345-
listener,
346-
emptySet());
347-
}
348-
349300
/**
350301
* Retrieves the field mappings on an index or indices using the Get Field Mapping API.
351302
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html">
@@ -679,42 +630,6 @@ public Cancellable getAsync(GetIndexRequest getIndexRequest, RequestOptions opti
679630
GetIndexResponse::fromXContent, listener, emptySet());
680631
}
681632

682-
/**
683-
* Retrieve information about one or more indexes
684-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html">
685-
* Indices Get Index API on elastic.co</a>
686-
* @param getIndexRequest the request
687-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
688-
* @return the response
689-
* @throws IOException in case there is a problem sending the request or parsing back the response
690-
* @deprecated This method uses an old request object which still refers to types, a deprecated feature. The method
691-
* {@link #get(GetIndexRequest, RequestOptions)} should be used instead, which accepts a new request object.
692-
*/
693-
@Deprecated
694-
public org.elasticsearch.action.admin.indices.get.GetIndexResponse get(
695-
org.elasticsearch.action.admin.indices.get.GetIndexRequest getIndexRequest, RequestOptions options) throws IOException {
696-
return restHighLevelClient.performRequestAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
697-
org.elasticsearch.action.admin.indices.get.GetIndexResponse::fromXContent, emptySet());
698-
}
699-
700-
/**
701-
* Retrieve information about one or more indexes
702-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html">
703-
* Indices Get Index API on elastic.co</a>
704-
* @param getIndexRequest the request
705-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
706-
* @param listener the listener to be notified upon request completion
707-
* @deprecated This method uses an old request object which still refers to types, a deprecated feature. The method
708-
* {@link #getAsync(GetIndexRequest, RequestOptions, ActionListener)} should be used instead, which accepts a new request object.
709-
* @return cancellable that may be used to cancel the request
710-
*/
711-
@Deprecated
712-
public Cancellable getAsync(org.elasticsearch.action.admin.indices.get.GetIndexRequest getIndexRequest, RequestOptions options,
713-
ActionListener<org.elasticsearch.action.admin.indices.get.GetIndexResponse> listener) {
714-
return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
715-
org.elasticsearch.action.admin.indices.get.GetIndexResponse::fromXContent, listener, emptySet());
716-
}
717-
718633
/**
719634
* Force merge one or more indices using the Force Merge API.
720635
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">

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

-16
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,6 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) {
189189
return request;
190190
}
191191

192-
@Deprecated
193-
static Request getMappings(org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest) {
194-
String[] indices = getMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getMappingsRequest.indices();
195-
String[] types = getMappingsRequest.types() == null ? Strings.EMPTY_ARRAY : getMappingsRequest.types();
196-
197-
Request request = new Request(HttpGet.METHOD_NAME, RequestConverters.endpoint(indices, "_mapping", types));
198-
199-
RequestConverters.Params parameters = new RequestConverters.Params();
200-
parameters.withMasterTimeout(getMappingsRequest.masterNodeTimeout());
201-
parameters.withIndicesOptions(getMappingsRequest.indicesOptions());
202-
parameters.withLocal(getMappingsRequest.local());
203-
parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
204-
request.addParameters(parameters.asMap());
205-
return request;
206-
}
207-
208192
static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest) {
209193
String[] indices = getFieldMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.indices();
210194
String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public boolean equals(Object obj) {
133133
&& Objects.equals(id, other.id)
134134
&& docVersion == other.docVersion
135135
&& found == other.found
136-
&& tookInMillis == tookInMillis
136+
&& tookInMillis == other.tookInMillis
137137
&& Objects.equals(termVectorList, other.termVectorList);
138138
}
139139

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.elasticsearch.common.ParseField;
2222
import org.elasticsearch.common.ParsingException;
23-
import org.elasticsearch.common.bytes.BytesArray;
2423
import org.elasticsearch.common.bytes.BytesReference;
2524
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
2625
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -60,7 +59,7 @@ private static void declareParserOptions(ConstructingObjectParser<?, ?> parser)
6059
parser.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> {
6160
XContentBuilder builder = XContentBuilder.builder(p.contentType().xContent());
6261
builder.copyCurrentStructure(p);
63-
return BytesArray.bytes(builder);
62+
return BytesReference.bytes(builder);
6463
}, QUERY_FIELD);
6564
parser.declareStringArray(ConstructingObjectParser.constructorArg(), INDICES_FIELD);
6665
parser.declareString(ConstructingObjectParser.constructorArg(), MATCH_FIELD_FIELD);

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.elasticsearch.common.ParseField;
2323
import org.elasticsearch.common.Strings;
24-
import org.elasticsearch.common.bytes.BytesArray;
2524
import org.elasticsearch.common.bytes.BytesReference;
2625
import org.elasticsearch.common.unit.TimeValue;
2726
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
@@ -86,7 +85,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject {
8685
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> {
8786
XContentBuilder builder = JsonXContent.contentBuilder();
8887
builder.copyCurrentStructure(p);
89-
return BytesArray.bytes(builder);
88+
return BytesReference.bytes(builder);
9089
}, STEP_INFO_FIELD);
9190
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> PhaseExecutionInfo.parse(p, ""),
9291
PHASE_EXECUTION_INFO);

0 commit comments

Comments
 (0)