Skip to content

Commit 49781b9

Browse files
committed
Merge branch '6.x' into feature-jindex-6x
2 parents eb6b75e + 2f55b78 commit 49781b9

File tree

158 files changed

+2644
-1664
lines changed

Some content is hidden

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

158 files changed

+2644
-1664
lines changed

TESTING.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ Default value provided below in [brackets].
150150

151151
=== Load balancing and caches.
152152

153-
By default the tests run on up to 4 JVMs based on the number of cores. If you
154-
want to explicitly specify the number of JVMs you can do so on the command
153+
By default the tests run on multiple processes using all the available cores on all
154+
available CPUs. Not including hyper-threading.
155+
If you want to explicitly specify the number of JVMs you can do so on the command
155156
line:
156157

157158
----------------------------

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,32 @@ class BuildPlugin implements Plugin<Project> {
774774
}
775775

776776
static void applyCommonTestConfig(Project project) {
777+
String defaultParallel = 'auto'
778+
// Count physical cores on any Linux distro ( don't count hyper-threading )
779+
if (project.file("/proc/cpuinfo").exists()) {
780+
Map<String, Integer> socketToCore = [:]
781+
String currentID = ""
782+
project.file("/proc/cpuinfo").readLines().forEach({ line ->
783+
if (line.contains(":")) {
784+
List<String> parts = line.split(":", 2).collect({it.trim()})
785+
String name = parts[0], value = parts[1]
786+
// the ID of the CPU socket
787+
if (name == "physical id") {
788+
currentID = value
789+
}
790+
// Number of cores not including hyper-threading
791+
if (name == "cpu cores") {
792+
assert currentID.isEmpty() == false
793+
socketToCore[currentID] = Integer.valueOf(value)
794+
currentID = ""
795+
}
796+
}
797+
})
798+
defaultParallel = socketToCore.values().sum().toString();
799+
}
777800
project.tasks.withType(RandomizedTestingTask) {
778801
jvm "${project.runtimeJavaHome}/bin/java"
779-
parallelism System.getProperty('tests.jvms', 'auto')
802+
parallelism System.getProperty('tests.jvms', defaultParallel)
780803
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
781804
onNonEmptyWorkDirectory 'wipe'
782805
leaveTemporary true

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,13 @@ class ClusterFormationTasks {
345345
// this will also allow new and old nodes in the BWC case to become the master
346346
esConfig['discovery.initial_state_timeout'] = '0s'
347347
}
348+
if (esConfig.containsKey('discovery.zen.master_election.wait_for_joins_timeout') == false) {
349+
// If a node decides to become master based on partial information from the pinging, don't let it hang for 30 seconds to correct
350+
// its mistake. Instead, only wait 5s to do another round of pinging.
351+
// This is necessary since we use 30s as the default timeout in REST requests waiting for cluster formation
352+
// so we need to bail quicker than the default 30s for the cluster to form in time.
353+
esConfig['discovery.zen.master_election.wait_for_joins_timeout'] = '5s'
354+
}
348355
esConfig['node.max_local_storage_nodes'] = node.config.numNodes
349356
esConfig['http.port'] = node.config.httpPort
350357
esConfig['transport.tcp.port'] = node.config.transportPort

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,6 @@
129129
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]translog[/\\]TranslogReader.java" checks="LineLength" />
130130
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]translog[/\\]TranslogSnapshot.java" checks="LineLength" />
131131
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]translog[/\\]TranslogWriter.java" checks="LineLength" />
132-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndexingMemoryController.java" checks="LineLength" />
133-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndicesService.java" checks="LineLength" />
134-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analysis[/\\]PreBuiltCacheFactory.java" checks="LineLength" />
135-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]breaker[/\\]HierarchyCircuitBreakerService.java" checks="LineLength" />
136-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]flush[/\\]ShardsSyncedFlushResult.java" checks="LineLength" />
137-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]flush[/\\]SyncedFlushService.java" checks="LineLength" />
138-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]PeerRecoverySourceService.java" checks="LineLength" />
139-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]RecoveryFailedException.java" checks="LineLength" />
140-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]RecoverySettings.java" checks="LineLength" />
141-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]RecoveryState.java" checks="LineLength" />
142-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]store[/\\]IndicesStore.java" checks="LineLength" />
143-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]store[/\\]TransportNodesListShardStoreMetaData.java" checks="LineLength" />
144132
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]GcNames.java" checks="LineLength" />
145133
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]HotThreads.java" checks="LineLength" />
146134
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]Node.java" checks="LineLength" />
@@ -256,30 +244,6 @@
256244
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]translog[/\\]TranslogTests.java" checks="LineLength" />
257245
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indexing[/\\]IndexActionIT.java" checks="LineLength" />
258246
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indexlifecycle[/\\]IndexLifecycleActionIT.java" checks="LineLength" />
259-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndexingMemoryControllerTests.java" checks="LineLength" />
260-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndicesLifecycleListenerIT.java" checks="LineLength" />
261-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]IndicesOptionsIntegrationIT.java" checks="LineLength" />
262-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]analyze[/\\]AnalyzeActionIT.java" checks="LineLength" />
263-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]exists[/\\]types[/\\]TypesExistsIT.java" checks="LineLength" />
264-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]flush[/\\]FlushIT.java" checks="LineLength" />
265-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]flush[/\\]SyncedFlushSingleNodeTests.java" checks="LineLength" />
266-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]flush[/\\]SyncedFlushUtil.java" checks="LineLength" />
267-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]mapping[/\\]ConcurrentDynamicTemplateIT.java" checks="LineLength" />
268-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]mapping[/\\]SimpleGetFieldMappingsIT.java" checks="LineLength" />
269-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]mapping[/\\]SimpleGetMappingsIT.java" checks="LineLength" />
270-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]mapping[/\\]UpdateMappingIntegrationIT.java" checks="LineLength" />
271-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]memory[/\\]breaker[/\\]CircuitBreakerUnitTests.java" checks="LineLength" />
272-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]memory[/\\]breaker[/\\]RandomExceptionCircuitBreakerIT.java" checks="LineLength" />
273-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]IndexPrimaryRelocationIT.java" checks="LineLength" />
274-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]IndexRecoveryIT.java" checks="LineLength" />
275-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]RecoverySourceHandlerTests.java" checks="LineLength" />
276-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]recovery[/\\]RecoveryStatusTests.java" checks="LineLength" />
277-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]settings[/\\]UpdateNumberOfReplicasIT.java" checks="LineLength" />
278-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]state[/\\]OpenCloseIndexIT.java" checks="LineLength" />
279-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]state[/\\]RareClusterStateIT.java" checks="LineLength" />
280-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]stats[/\\]IndexStatsIT.java" checks="LineLength" />
281-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]store[/\\]IndicesStoreIntegrationIT.java" checks="LineLength" />
282-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]indices[/\\]store[/\\]IndicesStoreTests.java" checks="LineLength" />
283247
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]JvmGcMonitorServiceSettingsTests.java" checks="LineLength" />
284248
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]PluginsServiceTests.java" checks="LineLength" />
285249
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]recovery[/\\]FullRollingRestartIT.java" checks="LineLength" />

buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
2424
import org.gradle.testkit.runner.GradleRunner;
2525
import org.junit.BeforeClass;
26-
import org.junit.Ignore;
2726
import org.junit.Rule;
2827
import org.junit.rules.TemporaryFolder;
2928

@@ -39,7 +38,6 @@
3938
import java.util.Objects;
4039
import java.util.stream.Collectors;
4140

42-
@Ignore
4341
public class BuildExamplePluginsIT extends GradleIntegrationTestCase {
4442

4543
private static List<File> EXAMPLE_PLUGINS = Collections.unmodifiableList(

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class IndexLifecycleClient {
4747
}
4848

4949
/**
50-
* Retrieve one or more lifecycle policy definition
51-
* See <a href="https://fix-me-when-we-have-docs.com">
50+
* Retrieve one or more lifecycle policy definition. See
51+
* <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-ilm-ilm-get-lifecycle-policy.html">
5252
* the docs</a> for more.
5353
* @param request the request
5454
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
@@ -62,8 +62,8 @@ public GetLifecyclePolicyResponse getLifecyclePolicy(GetLifecyclePolicyRequest r
6262
}
6363

6464
/**
65-
* Asynchronously retrieve one or more lifecycle policy definition
66-
* See <a href="https://fix-me-when-we-have-docs.com">
65+
* Asynchronously retrieve one or more lifecycle policy definition. See
66+
* <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-ilm-ilm-get-lifecycle-policy.html">
6767
* the docs</a> for more.
6868
* @param request the request
6969
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.client.ml.CloseJobRequest;
3131
import org.elasticsearch.client.ml.DeleteCalendarRequest;
3232
import org.elasticsearch.client.ml.DeleteDatafeedRequest;
33+
import org.elasticsearch.client.ml.DeleteFilterRequest;
3334
import org.elasticsearch.client.ml.DeleteForecastRequest;
3435
import org.elasticsearch.client.ml.DeleteJobRequest;
3536
import org.elasticsearch.client.ml.DeleteModelSnapshotRequest;
@@ -537,4 +538,13 @@ static Request updateFilter(UpdateFilterRequest updateFilterRequest) throws IOEx
537538
request.setEntity(createEntity(updateFilterRequest, REQUEST_BODY_CONTENT_TYPE));
538539
return request;
539540
}
541+
542+
static Request deleteFilter(DeleteFilterRequest deleteFilterRequest) {
543+
String endpoint = new EndpointBuilder()
544+
.addPathPartAsIs("_xpack", "ml", "filters")
545+
.addPathPart(deleteFilterRequest.getId())
546+
.build();
547+
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
548+
return request;
549+
}
540550
}

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.client.ml.CloseJobResponse;
2525
import org.elasticsearch.client.ml.DeleteCalendarRequest;
2626
import org.elasticsearch.client.ml.DeleteDatafeedRequest;
27+
import org.elasticsearch.client.ml.DeleteFilterRequest;
2728
import org.elasticsearch.client.ml.DeleteForecastRequest;
2829
import org.elasticsearch.client.ml.DeleteJobRequest;
2930
import org.elasticsearch.client.ml.DeleteJobResponse;
@@ -1371,4 +1372,44 @@ public void updateFilterAsync(UpdateFilterRequest request, RequestOptions option
13711372
listener,
13721373
Collections.emptySet());
13731374
}
1375+
1376+
/**
1377+
* Deletes the given Machine Learning filter
1378+
* <p>
1379+
* For additional info
1380+
* see <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html">
1381+
* ML Delete Filter documentation</a>
1382+
*
1383+
* @param request The request to delete the filter
1384+
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1385+
* @return action acknowledgement
1386+
* @throws IOException when there is a serialization issue sending the request or receiving the response
1387+
*/
1388+
public AcknowledgedResponse deleteFilter(DeleteFilterRequest request, RequestOptions options) throws IOException {
1389+
return restHighLevelClient.performRequestAndParseEntity(request,
1390+
MLRequestConverters::deleteFilter,
1391+
options,
1392+
AcknowledgedResponse::fromXContent,
1393+
Collections.emptySet());
1394+
}
1395+
1396+
/**
1397+
* Deletes the given Machine Learning filter asynchronously and notifies the listener on completion
1398+
* <p>
1399+
* For additional info
1400+
* see <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html">
1401+
* ML Delete Filter documentation</a>
1402+
*
1403+
* @param request The request to delete the filter
1404+
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1405+
* @param listener Listener to be notified upon request completion
1406+
*/
1407+
public void deleteFilterAsync(DeleteFilterRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
1408+
restHighLevelClient.performRequestAsyncAndParseEntity(request,
1409+
MLRequestConverters::deleteFilter,
1410+
options,
1411+
AcknowledgedResponse::fromXContent,
1412+
listener,
1413+
Collections.emptySet());
1414+
}
13741415
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class TermVectorsRequest implements ToXContentObject, Validatable {
3333
private final String index;
3434
private final String type;
3535
private String id = null;
36+
private XContentBuilder docBuilder = null;
37+
3638
private String routing = null;
3739
private String preference = null;
3840
private boolean realtime = true;
@@ -44,7 +46,6 @@ public class TermVectorsRequest implements ToXContentObject, Validatable {
4446
private boolean requestTermStatistics = false;
4547
private Map<String, String> perFieldAnalyzer = null;
4648
private Map<String, Integer> filterSettings = null;
47-
private XContentBuilder docBuilder = null;
4849

4950

5051
/**
@@ -54,18 +55,21 @@ public class TermVectorsRequest implements ToXContentObject, Validatable {
5455
* @param docId - id of the document
5556
*/
5657
public TermVectorsRequest(String index, String type, String docId) {
57-
this(index, type);
58+
this.index = index;
59+
this.type = type;
5860
this.id = docId;
5961
}
6062

6163
/**
6264
* Constructs TermVectorRequest for an artificial document
6365
* @param index - index of the document
6466
* @param type - type of the document
67+
* @param docBuilder - an artificial document
6568
*/
66-
public TermVectorsRequest(String index, String type) {
69+
public TermVectorsRequest(String index, String type, XContentBuilder docBuilder) {
6770
this.index = index;
6871
this.type = type;
72+
this.docBuilder = docBuilder;
6973
}
7074

7175
/**
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
package org.elasticsearch.client.ml;
20+
21+
import org.elasticsearch.client.Validatable;
22+
23+
import java.util.Objects;
24+
25+
/**
26+
* A request to delete a machine learning filter
27+
*/
28+
public class DeleteFilterRequest implements Validatable {
29+
30+
private final String filterId;
31+
32+
public DeleteFilterRequest(String filterId) {
33+
this.filterId = Objects.requireNonNull(filterId, "[filter_id] is required");
34+
}
35+
36+
public String getId() {
37+
return filterId;
38+
}
39+
40+
@Override
41+
public int hashCode() {
42+
return Objects.hash(filterId);
43+
}
44+
45+
@Override
46+
public boolean equals(Object obj) {
47+
if (this == obj) {
48+
return true;
49+
}
50+
if (obj == null) {
51+
return false;
52+
}
53+
if (getClass() != obj.getClass()) {
54+
return false;
55+
}
56+
final DeleteFilterRequest other = (DeleteFilterRequest) obj;
57+
58+
return Objects.equals(filterId, other.filterId);
59+
}
60+
}

0 commit comments

Comments
 (0)