Skip to content

Commit d894679

Browse files
committed
Merge branch '6.x' into ccr-6.x
* commit '9088d811ce9cff922e6ef1befbeb0f1e0c27016a': (23 commits) Generalize remote license checker (#32971) Trim translog when safe commit advanced (#32967) Fix an inaccuracy in the dynamic templates documentation. (#32890) HLREST: AwaitsFix ML Test Make Geo Context Mapping Parsing More Strict (#32862) Add mzn and dz to unsupported locales (#32957) Use settings from the context in BootstrapChecks (#32908) Update docs for node specifications (#30468) HLRC: Forbid all Elasticsearch logging infra (#32784) Fix use of deprecated apis Only configure publishing if it's applied externally (#32351) Protect ScriptedMetricIT test cases against failures on 0-doc shards (#32959) (#32968) Scripted metric aggregations: add deprecation warning and system (#32944) Watcher: Properly find next valid date in cron expressions (#32734) Fix some small issues in the getting started docs (#30346) Set forbidden APIs target compatibility to compiler java version (#32935) [TEST] Add "ne" as an unsupported SimpleKdc locale (#32700) MINOR: Remove `IndexTemplateFilter` (#32841) (#32974) INGEST: Create Index Before Pipeline Execute (#32786) (#32975) NETWORKING: Make RemoteClusterConn. Lazy Resolve DNS (#32764) (#32976) ...
2 parents ed70e2c + 9088d81 commit d894679

File tree

120 files changed

+3922
-2555
lines changed

Some content is hidden

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

120 files changed

+3922
-2555
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,12 @@ class BuildPlugin implements Plugin<Project> {
528528
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom generatePOMTask ->
529529
// The GenerateMavenPom task is aggressive about setting the destination, instead of fighting it,
530530
// just make a copy.
531+
generatePOMTask.ext.pomFileName = "${project.archivesBaseName}-${project.version}.pom"
531532
doLast {
532533
project.copy {
533534
from generatePOMTask.destination
534535
into "${project.buildDir}/distributions"
535-
rename { "${project.archivesBaseName}-${project.version}.pom" }
536+
rename { generatePOMTask.ext.pomFileName }
536537
}
537538
}
538539
// build poms with assemble (if the assemble task exists)
@@ -798,6 +799,8 @@ class BuildPlugin implements Plugin<Project> {
798799
systemProperty 'tests.task', path
799800
systemProperty 'tests.security.manager', 'true'
800801
systemProperty 'jna.nosys', 'true'
802+
// TODO: remove this deprecation compatibility setting for 7.0
803+
systemProperty 'es.aggregations.enable_scripted_metric_agg_param', 'false'
801804
systemProperty 'es.scripting.exception_for_missing_value', 'true'
802805
systemProperty 'compiler.java', project.ext.compilerJavaVersion.getMajorVersion()
803806
if (project.ext.inFipsJvm) {

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy

Lines changed: 35 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,19 @@
1919
package org.elasticsearch.gradle.plugin
2020

2121
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
22-
import nebula.plugin.info.scm.ScmInfoPlugin
22+
import nebula.plugin.publishing.maven.MavenScmPlugin
2323
import org.elasticsearch.gradle.BuildPlugin
2424
import org.elasticsearch.gradle.NoticeTask
2525
import org.elasticsearch.gradle.test.RestIntegTestTask
2626
import org.elasticsearch.gradle.test.RunTask
27-
import org.gradle.api.InvalidUserDataException
2827
import org.gradle.api.Project
29-
import org.gradle.api.Task
30-
import org.gradle.api.XmlProvider
3128
import org.gradle.api.publish.maven.MavenPublication
3229
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
30+
import org.gradle.api.publish.maven.tasks.GenerateMavenPom
3331
import org.gradle.api.tasks.SourceSet
3432
import org.gradle.api.tasks.bundling.Zip
33+
import org.gradle.jvm.tasks.Jar
3534

36-
import java.nio.file.Files
37-
import java.nio.file.Path
38-
import java.nio.file.StandardCopyOption
3935
import java.util.regex.Matcher
4036
import java.util.regex.Pattern
4137
/**
@@ -55,16 +51,10 @@ public class PluginBuildPlugin extends BuildPlugin {
5551
String name = project.pluginProperties.extension.name
5652
project.archivesBaseName = name
5753

58-
if (project.pluginProperties.extension.hasClientJar) {
59-
// for plugins which work with the transport client, we copy the jar
60-
// file to a new name, copy the nebula generated pom to the same name,
61-
// and generate a different pom for the zip
62-
addClientJarPomGeneration(project)
63-
addClientJarTask(project)
64-
}
65-
// while the jar isn't normally published, we still at least build a pom of deps
66-
// in case it is published, for instance when other plugins extend this plugin
67-
configureJarPom(project)
54+
// set teh project description so it will be picked up by publishing
55+
project.description = project.pluginProperties.extension.description
56+
57+
configurePublishing(project)
6858

6959
project.integTestCluster.dependsOn(project.bundlePlugin)
7060
project.tasks.run.dependsOn(project.bundlePlugin)
@@ -92,6 +82,32 @@ public class PluginBuildPlugin extends BuildPlugin {
9282
project.tasks.create('run', RunTask) // allow running ES with this plugin in the foreground of a build
9383
}
9484

85+
private void configurePublishing(Project project) {
86+
// Only configure publishing if applied externally
87+
if (project.pluginProperties.extension.hasClientJar) {
88+
project.plugins.apply(MavenScmPlugin.class)
89+
// Only change Jar tasks, we don't want a -client zip so we can't change archivesBaseName
90+
project.tasks.withType(Jar) {
91+
baseName = baseName + "-client"
92+
}
93+
// always configure publishing for client jars
94+
project.plugins.apply(MavenScmPlugin.class)
95+
project.publishing.publications.nebula(MavenPublication).artifactId(
96+
project.pluginProperties.extension.name + "-client"
97+
)
98+
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom generatePOMTask ->
99+
generatePOMTask.ext.pomFileName = "${project.archivesBaseName}-client-${project.version}.pom"
100+
}
101+
} else {
102+
project.plugins.withType(MavenPublishPlugin).whenPluginAdded {
103+
project.publishing.publications.nebula(MavenPublication).artifactId(
104+
project.pluginProperties.extension.name
105+
)
106+
}
107+
108+
}
109+
}
110+
95111
private static void configureDependencies(Project project) {
96112
project.dependencies {
97113
compileOnly "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}"
@@ -159,33 +175,6 @@ public class PluginBuildPlugin extends BuildPlugin {
159175
}
160176

161177
/** Adds a task to move jar and associated files to a "-client" name. */
162-
protected static void addClientJarTask(Project project) {
163-
Task clientJar = project.tasks.create('clientJar')
164-
clientJar.dependsOn(project.jar, project.tasks.generatePomFileForClientJarPublication, project.javadocJar, project.sourcesJar)
165-
clientJar.doFirst {
166-
Path jarFile = project.jar.outputs.files.singleFile.toPath()
167-
String clientFileName = jarFile.fileName.toString().replace(project.version, "client-${project.version}")
168-
Files.copy(jarFile, jarFile.resolveSibling(clientFileName), StandardCopyOption.REPLACE_EXISTING)
169-
170-
String clientPomFileName = clientFileName.replace('.jar', '.pom')
171-
Files.copy(
172-
project.tasks.generatePomFileForClientJarPublication.outputs.files.singleFile.toPath(),
173-
jarFile.resolveSibling(clientPomFileName),
174-
StandardCopyOption.REPLACE_EXISTING
175-
)
176-
177-
String sourcesFileName = jarFile.fileName.toString().replace('.jar', '-sources.jar')
178-
String clientSourcesFileName = clientFileName.replace('.jar', '-sources.jar')
179-
Files.copy(jarFile.resolveSibling(sourcesFileName), jarFile.resolveSibling(clientSourcesFileName),
180-
StandardCopyOption.REPLACE_EXISTING)
181-
182-
String javadocFileName = jarFile.fileName.toString().replace('.jar', '-javadoc.jar')
183-
String clientJavadocFileName = clientFileName.replace('.jar', '-javadoc.jar')
184-
Files.copy(jarFile.resolveSibling(javadocFileName), jarFile.resolveSibling(clientJavadocFileName),
185-
StandardCopyOption.REPLACE_EXISTING)
186-
}
187-
project.assemble.dependsOn(clientJar)
188-
}
189178

190179
static final Pattern GIT_PATTERN = Pattern.compile(/git@([^:]+):([^\.]+)\.git/)
191180

@@ -207,39 +196,11 @@ public class PluginBuildPlugin extends BuildPlugin {
207196

208197
/** Adds nebula publishing task to generate a pom file for the plugin. */
209198
protected static void addClientJarPomGeneration(Project project) {
210-
project.plugins.apply(MavenPublishPlugin.class)
211-
212-
project.publishing {
213-
publications {
214-
clientJar(MavenPublication) {
215-
from project.components.java
216-
artifactId = project.pluginProperties.extension.name + '-client'
217-
pom.withXml { XmlProvider xml ->
218-
Node root = xml.asNode()
219-
root.appendNode('name', project.pluginProperties.extension.name)
220-
root.appendNode('description', project.pluginProperties.extension.description)
221-
root.appendNode('url', urlFromOrigin(project.scminfo.origin))
222-
Node scmNode = root.appendNode('scm')
223-
scmNode.appendNode('url', project.scminfo.origin)
224-
}
225-
}
226-
}
227-
}
199+
project.plugins.apply(MavenScmPlugin.class)
200+
project.description = project.pluginProperties.extension.description
228201
}
229202

230203
/** Configure the pom for the main jar of this plugin */
231-
protected static void configureJarPom(Project project) {
232-
project.plugins.apply(ScmInfoPlugin.class)
233-
project.plugins.apply(MavenPublishPlugin.class)
234-
235-
project.publishing {
236-
publications {
237-
nebula(MavenPublication) {
238-
artifactId project.pluginProperties.extension.name
239-
}
240-
}
241-
}
242-
}
243204

244205
protected void addNoticeGeneration(Project project) {
245206
File licenseFile = project.pluginProperties.extension.licenseFile

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.elasticsearch.gradle.precommit
2020

2121
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
2222
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
23+
import org.gradle.api.JavaVersion
2324
import org.gradle.api.Project
2425
import org.gradle.api.Task
2526
import org.gradle.api.plugins.JavaBasePlugin
@@ -93,6 +94,11 @@ class PrecommitTasks {
9394
signaturesURLs = project.forbiddenApis.signaturesURLs +
9495
[ getClass().getResource('/forbidden/es-server-signatures.txt') ]
9596
}
97+
// forbidden apis doesn't support Java 11, so stop at 10
98+
String targetMajorVersion = (project.compilerJavaVersion.compareTo(JavaVersion.VERSION_1_10) > 0 ?
99+
JavaVersion.VERSION_1_10 :
100+
project.compilerJavaVersion).getMajorVersion()
101+
targetCompatibility = Integer.parseInt(targetMajorVersion) >= 9 ?targetMajorVersion : "1.${targetMajorVersion}"
96102
}
97103
Task forbiddenApis = project.tasks.findByName('forbiddenApis')
98104
forbiddenApis.group = "" // clear group, so this does not show up under verification tasks

client/rest-high-level/src/main/resources/forbidden/rest-high-level-signatures.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,14 @@ org.apache.http.entity.ContentType#create(java.lang.String,java.lang.String)
2020
org.apache.http.entity.ContentType#create(java.lang.String,java.nio.charset.Charset)
2121
org.apache.http.entity.ContentType#create(java.lang.String,org.apache.http.NameValuePair[])
2222

23+
@defaultMessage ES's logging infrastructure uses log4j2 which we don't want to force on high level rest client users
24+
org.elasticsearch.common.logging.DeprecationLogger
25+
org.elasticsearch.common.logging.ESLoggerFactory
26+
org.elasticsearch.common.logging.LogConfigurator
27+
org.elasticsearch.common.logging.LoggerMessageFormat
28+
org.elasticsearch.common.logging.Loggers
29+
org.elasticsearch.common.logging.NodeNamePatternConverter
30+
org.elasticsearch.common.logging.PrefixLogger
31+
2332
@defaultMessage We can't rely on log4j2 being on the classpath so don't log deprecations!
2433
org.elasticsearch.common.xcontent.LoggingDeprecationHandler

client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.client;
2121

22+
import org.apache.http.util.EntityUtils;
2223
import org.elasticsearch.ElasticsearchException;
2324
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
2425
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@@ -34,6 +35,7 @@
3435
import org.elasticsearch.common.unit.ByteSizeUnit;
3536
import org.elasticsearch.common.xcontent.XContentType;
3637
import org.elasticsearch.common.xcontent.support.XContentMapValues;
38+
import org.elasticsearch.client.Request;
3739
import org.elasticsearch.indices.recovery.RecoverySettings;
3840
import org.elasticsearch.rest.RestStatus;
3941

@@ -178,6 +180,8 @@ public void testClusterHealthYellowClusterLevel() throws IOException {
178180
request.level(ClusterHealthRequest.Level.CLUSTER);
179181
ClusterHealthResponse response = execute(request, highLevelClient().cluster()::health, highLevelClient().cluster()::healthAsync);
180182

183+
logger.info("Shard stats\n{}", EntityUtils.toString(
184+
client().performRequest(new Request("GET", "/_cat/shards")).getEntity()));
181185
assertYellowShards(response);
182186
assertThat(response.getIndices().size(), equalTo(0));
183187
}
@@ -190,6 +194,8 @@ public void testClusterHealthYellowIndicesLevel() throws IOException {
190194
request.level(ClusterHealthRequest.Level.INDICES);
191195
ClusterHealthResponse response = execute(request, highLevelClient().cluster()::health, highLevelClient().cluster()::healthAsync);
192196

197+
logger.info("Shard stats\n{}", EntityUtils.toString(
198+
client().performRequest(new Request("GET", "/_cat/shards")).getEntity()));
193199
assertYellowShards(response);
194200
assertThat(response.getIndices().size(), equalTo(2));
195201
for (Map.Entry<String, ClusterIndexHealth> entry : response.getIndices().entrySet()) {

client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.elasticsearch.client;
2020

2121
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
22+
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
2223
import org.elasticsearch.common.unit.TimeValue;
2324
import org.elasticsearch.protocol.xpack.ml.DeleteJobRequest;
2425
import org.elasticsearch.protocol.xpack.ml.DeleteJobResponse;
@@ -36,6 +37,7 @@
3637

3738
import static org.hamcrest.Matchers.is;
3839

40+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32993")
3941
public class MachineLearningIT extends ESRestHighLevelClientTestCase {
4042

4143
public void testPutJob() throws Exception {

docs/build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ integTestCluster {
4141
// TODO: remove this for 7.0, this exists to allow the doc examples in 6.x to continue using the defaults
4242
systemProperty 'es.scripting.use_java_time', 'false'
4343
systemProperty 'es.scripting.update.ctx_in_params', 'false'
44+
45+
// TODO: remove this deprecation compatibility setting for 7.0
46+
systemProperty 'es.aggregations.enable_scripted_metric_agg_param', 'false'
4447
}
4548

4649
// remove when https://github.com/elastic/elasticsearch/issues/31305 is fixed
@@ -393,25 +396,25 @@ buildRestTests.setups['stored_scripted_metric_script'] = '''
393396
- do:
394397
put_script:
395398
id: "my_init_script"
396-
body: { "script": { "lang": "painless", "source": "params._agg.transactions = []" } }
399+
body: { "script": { "lang": "painless", "source": "state.transactions = []" } }
397400
- match: { acknowledged: true }
398401
399402
- do:
400403
put_script:
401404
id: "my_map_script"
402-
body: { "script": { "lang": "painless", "source": "params._agg.transactions.add(doc.type.value == 'sale' ? doc.amount.value : -1 * doc.amount.value)" } }
405+
body: { "script": { "lang": "painless", "source": "state.transactions.add(doc.type.value == 'sale' ? doc.amount.value : -1 * doc.amount.value)" } }
403406
- match: { acknowledged: true }
404407
405408
- do:
406409
put_script:
407410
id: "my_combine_script"
408-
body: { "script": { "lang": "painless", "source": "double profit = 0;for (t in params._agg.transactions) { profit += t; } return profit" } }
411+
body: { "script": { "lang": "painless", "source": "double profit = 0;for (t in state.transactions) { profit += t; } return profit" } }
409412
- match: { acknowledged: true }
410413
411414
- do:
412415
put_script:
413416
id: "my_reduce_script"
414-
body: { "script": { "lang": "painless", "source": "double profit = 0;for (a in params._aggs) { profit += a; } return profit" } }
417+
body: { "script": { "lang": "painless", "source": "double profit = 0;for (a in states) { profit += a; } return profit" } }
415418
- match: { acknowledged: true }
416419
'''
417420

docs/reference/cluster.asciidoc

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,70 @@
66
["float",id="cluster-nodes"]
77
== Node specification
88

9-
Most cluster level APIs allow to specify which nodes to execute on (for
10-
example, getting the node stats for a node). Nodes can be identified in
11-
the APIs either using their internal node id, the node name, address,
12-
custom attributes, or just the `_local` node receiving the request. For
13-
example, here are some sample executions of nodes info:
9+
Some cluster-level APIs may operate on a subset of the nodes which can be
10+
specified with _node filters_. For example, the <<tasks,Task Management>>,
11+
<<cluster-nodes-stats,Nodes Stats>>, and <<cluster-nodes-info,Nodes Info>> APIs
12+
can all report results from a filtered set of nodes rather than from all nodes.
13+
14+
_Node filters_ are written as a comma-separated list of individual filters,
15+
each of which adds or removes nodes from the chosen subset. Each filter can be
16+
one of the following:
17+
18+
* `_all`, to add all nodes to the subset.
19+
* `_local`, to add the local node to the subset.
20+
* `_master`, to add the currently-elected master node to the subset.
21+
* a node id or name, to add this node to the subset.
22+
* an IP address or hostname, to add all matching nodes to the subset.
23+
* a pattern, using `*` wildcards, which adds all nodes to the subset
24+
whose name, address or hostname matches the pattern.
25+
* `master:true`, `data:true`, `ingest:true` or `coordinating_only:true`, which
26+
respectively add to the subset all master-eligible nodes, all data nodes,
27+
all ingest nodes, and all coordinating-only nodes.
28+
* `master:false`, `data:false`, `ingest:false` or `coordinating_only:false`,
29+
which respectively remove from the subset all master-eligible nodes, all data
30+
nodes, all ingest nodes, and all coordinating-only nodes.
31+
* a pair of patterns, using `*` wildcards, of the form `attrname:attrvalue`,
32+
which adds to the subset all nodes with a custom node attribute whose name
33+
and value match the respective patterns. Custom node attributes are
34+
configured by setting properties in the configuration file of the form
35+
`node.attr.attrname: attrvalue`.
36+
37+
NOTE: node filters run in the order in which they are given, which is important
38+
if using filters that remove nodes from the set. For example
39+
`_all,master:false` means all the nodes except the master-eligible ones, but
40+
`master:false,_all` means the same as `_all` because the `_all` filter runs
41+
after the `master:false` filter.
42+
43+
NOTE: if no filters are given, the default is to select all nodes. However, if
44+
any filters are given then they run starting with an empty chosen subset. This
45+
means that filters such as `master:false` which remove nodes from the chosen
46+
subset are only useful if they come after some other filters. When used on its
47+
own, `master:false` selects no nodes.
48+
49+
Here are some examples of the use of node filters with the
50+
<<cluster-nodes-info,Nodes Info>> APIs.
1451

1552
[source,js]
1653
--------------------------------------------------
17-
# Local
54+
# If no filters are given, the default is to select all nodes
55+
GET /_nodes
56+
# Explicitly select all nodes
57+
GET /_nodes/_all
58+
# Select just the local node
1859
GET /_nodes/_local
19-
# Address
20-
GET /_nodes/10.0.0.3,10.0.0.4
21-
GET /_nodes/10.0.0.*
22-
# Names
60+
# Select the elected master node
61+
GET /_nodes/_master
62+
# Select nodes by name, which can include wildcards
2363
GET /_nodes/node_name_goes_here
2464
GET /_nodes/node_name_goes_*
25-
# Attributes (set something like node.attr.rack: 2 in the config)
65+
# Select nodes by address, which can include wildcards
66+
GET /_nodes/10.0.0.3,10.0.0.4
67+
GET /_nodes/10.0.0.*
68+
# Select nodes by role
69+
GET /_nodes/_all,master:false
70+
GET /_nodes/data:true,ingest:true
71+
GET /_nodes/coordinating_only:true
72+
# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
2673
GET /_nodes/rack:2
2774
GET /_nodes/ra*:2
2875
GET /_nodes/ra*:2*

0 commit comments

Comments
 (0)