Skip to content

Commit 58533cf

Browse files
committed
Merge remote-tracking branch 'upstream/master' into object-fields
2 parents 9cefddf + 19ce9ce commit 58533cf

File tree

1,081 files changed

+13738
-17300
lines changed

Some content is hidden

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

1,081 files changed

+13738
-17300
lines changed

.ci/java-versions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ ES_BUILD_JAVA=openjdk12
88
ES_RUNTIME_JAVA=java11
99
GRADLE_TASK=build
1010

11+

.ci/matrix-runtime-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ES_RUNTIME_JAVA:
99
- java11
1010
- java12
1111
- openjdk12
12+
- openjdk13
1213
- zulu11
1314
- zulu12
1415
- corretto11

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ attention.
1010
- Have you followed the [contributor guidelines](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md)?
1111
- If submitting code, have you built your formula locally prior to submission with `gradle check`?
1212
- If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
13-
- If submitting code, have you checked that your submission is for an [OS that we support](https://www.elastic.co/support/matrix#show_os)?
13+
- If submitting code, have you checked that your submission is for an [OS and architecture that we support](https://www.elastic.co/support/matrix#show_os)?
1414
- If you are submitting this code for a class then read our [policy](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#contributing-as-part-of-a-class) for that.

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ Commercially licensed code that integrates with the rest of Elasticsearch. The
325325
`docs` subdirectory functions just like the top level `docs` subdirectory and
326326
the `qa` subdirectory functions just like the top level `qa` subdirectory. The
327327
`plugin` subdirectory contains the x-pack module which runs inside the
328-
Elasticsearch process. The `transport-client` subdirectory contains extensions
329-
to Elasticsearch's standard transport client to work properly with x-pack.
328+
Elasticsearch process.
330329

331330
### Gradle Build
332331

README.textile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ curl -XPUT 'http://localhost:9200/kimchy/_doc/2?pretty' -H 'Content-Type: applic
150150

151151
The above will index information into the @kimchy@ index. Each user will get their own special index.
152152

153-
Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well):
153+
Complete control on the index level is allowed. As an example, in the above case, we might want to change from the default 1 shard with 1 replica per index, to 2 shards with 1 replica per index (because this user tweets a lot). Here is how this can be done (the configuration can be in yaml as well):
154154

155155
<pre>
156156
curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d '
157157
{
158158
"index" : {
159-
"number_of_shards" : 1,
159+
"number_of_shards" : 2,
160160
"number_of_replicas" : 1
161161
}
162162
}'
@@ -191,7 +191,7 @@ h3. Distributed, Highly Available
191191

192192
Let's face it, things will fail....
193193

194-
Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replicas. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
194+
Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replicas. By default, an index is created with 1 shards and 1 replica per shard (1/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
195195

196196
In order to play with the distributed nature of Elasticsearch, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed.
197197

TESTING.asciidoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,6 @@ e.g. -Dtests.rest.suite=index,get,create/10_with_id
305305
blacklisted and need to be skipped
306306
e.g. -Dtests.rest.blacklist=index/*/Index document,get/10_basic/*
307307

308-
Note that the REST tests, like all the integration tests, can be run against an external
309-
cluster by specifying the `tests.cluster` property, which if present needs to contain a
310-
comma separated list of nodes to connect to (e.g. localhost:9300). A transport client will
311-
be created based on that and used for all the before|after test operations, and to extract
312-
the http addresses of the nodes so that REST requests can be sent to them.
313-
314308
== Testing packaging
315309

316310
The packaging tests use Vagrant virtual machines to verify that installing

benchmarks/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ archivesBaseName = 'elasticsearch-benchmarks'
2727
test.enabled = false
2828

2929
dependencies {
30-
compile("org.elasticsearch:elasticsearch:${version}") {
30+
compile(project(":server")) {
3131
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
3232
// us to invoke the JMH uberjar as usual.
3333
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'

build.gradle

Lines changed: 5 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ subprojects {
104104

105105
/* Introspect all versions of ES that may be tested against for backwards
106106
* compatibility. It is *super* important that this logic is the same as the
107-
* logic in VersionUtils.java, throwing out alphas because they don't have any
108-
* backwards compatibility guarantees and only keeping the latest beta or rc
109-
* in a branch if there are only betas and rcs in the branch so we have
110-
* *something* to test against. */
107+
* logic in VersionUtils.java. */
111108
BwcVersions versions = new BwcVersions(file('server/src/main/java/org/elasticsearch/Version.java').readLines('UTF-8'))
112109

113110
// build metadata from previous build, contains eg hashes for bwc builds
@@ -209,68 +206,7 @@ allprojects {
209206
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
210207
}
211208

212-
/* Sets up the dependencies that we build as part of this project but
213-
register as though they were external to resolve internally. We register
214-
them as external dependencies so the build plugin that we use can be used
215-
to build elasticsearch plugins outside of the elasticsearch source tree. */
216-
ext.projectSubstitutions = [
217-
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
218-
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
219-
"org.elasticsearch:elasticsearch:${version}": ':server',
220-
"org.elasticsearch:elasticsearch-cli:${version}": ':libs:elasticsearch-cli',
221-
"org.elasticsearch:elasticsearch-core:${version}": ':libs:core',
222-
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:nio',
223-
"org.elasticsearch:elasticsearch-x-content:${version}": ':libs:x-content',
224-
"org.elasticsearch:elasticsearch-geo:${version}": ':libs:elasticsearch-geo',
225-
"org.elasticsearch:elasticsearch-secure-sm:${version}": ':libs:secure-sm',
226-
"org.elasticsearch:elasticsearch-ssl-config:${version}": ':libs:elasticsearch-ssl-config',
227-
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
228-
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',
229-
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
230-
"org.elasticsearch.client:test:${version}": ':client:test',
231-
"org.elasticsearch.client:transport:${version}": ':client:transport',
232-
"org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${version}": ':modules:lang-painless:spi',
233-
"org.elasticsearch.test:framework:${version}": ':test:framework',
234-
"org.elasticsearch.test:logger-usage:${version}": ':test:logger-usage',
235-
"org.elasticsearch.xpack.test:feature-aware:${version}": ':x-pack:test:feature-aware',
236-
// for transport client
237-
"org.elasticsearch.plugin:transport-netty4-client:${version}": ':modules:transport-netty4',
238-
"org.elasticsearch.plugin:reindex-client:${version}": ':modules:reindex',
239-
"org.elasticsearch.plugin:lang-mustache-client:${version}": ':modules:lang-mustache',
240-
"org.elasticsearch.plugin:parent-join-client:${version}": ':modules:parent-join',
241-
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
242-
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
243-
"org.elasticsearch.plugin:rank-eval-client:${version}": ':modules:rank-eval',
244-
// for security example plugins
245-
"org.elasticsearch.plugin:x-pack-core:${version}": ':x-pack:plugin:core'
246-
]
247-
248-
/*
249-
* Gradle only resolve project substitutions during dependency resolution but
250-
* we sometimes want to do the resolution at other times. This creates a
251-
* convenient method we can call to do it.
252-
*/
253-
ext.dependencyToProject = { Dependency dep ->
254-
if (dep instanceof ProjectDependency) {
255-
return dep.dependencyProject
256-
} else {
257-
String substitution = projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
258-
if (substitution != null) {
259-
return findProject(substitution)
260-
}
261-
return null
262-
}
263-
}
264-
265209
project.afterEvaluate {
266-
configurations.matching { it.canBeResolved }.all {
267-
resolutionStrategy.dependencySubstitution { DependencySubstitutions subs ->
268-
projectSubstitutions.each { k,v ->
269-
subs.substitute(subs.module(k)).with(subs.project(v))
270-
}
271-
}
272-
}
273-
274210
// Handle javadoc dependencies across projects. Order matters: the linksOffline for
275211
// org.elasticsearch:elasticsearch must be the last one or all the links for the
276212
// other packages (e.g org.elasticsearch.client) will point to server rather than
@@ -279,10 +215,10 @@ allprojects {
279215
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
280216
Closure sortClosure = { a, b -> b.group <=> a.group }
281217
Closure depJavadocClosure = { shadowed, dep ->
282-
if (dep.group == null || false == dep.group.startsWith('org.elasticsearch')) {
218+
if ((dep instanceof ProjectDependency) == false) {
283219
return
284220
}
285-
Project upstreamProject = project.ext.dependencyToProject(dep)
221+
Project upstreamProject = dep.dependencyProject
286222
if (upstreamProject == null) {
287223
return
288224
}
@@ -338,8 +274,8 @@ gradle.projectsEvaluated {
338274
integTest.mustRunAfter test
339275
}
340276
configurations.matching { it.canBeResolved }.all { Configuration configuration ->
341-
dependencies.all { Dependency dep ->
342-
Project upstreamProject = dependencyToProject(dep)
277+
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
278+
Project upstreamProject = dep.dependencyProject
343279
if (upstreamProject != null) {
344280
if (project.path == upstreamProject.path) {
345281
// TODO: distribution integ tests depend on themselves (!), fix that
@@ -552,31 +488,6 @@ gradle.projectsEvaluated {
552488
}
553489
}
554490

555-
if (System.properties.get("build.compare") != null) {
556-
apply plugin: 'compare-gradle-builds'
557-
compareGradleBuilds {
558-
ext.referenceProject = System.properties.get("build.compare")
559-
doFirst {
560-
if (file(referenceProject).exists() == false) {
561-
throw new GradleException(
562-
"Use git worktree to check out a version to compare against to ../elasticsearch_build_reference"
563-
)
564-
}
565-
}
566-
sourceBuild {
567-
gradleVersion = gradle.getGradleVersion()
568-
projectDir = referenceProject
569-
tasks = ["clean", "assemble"]
570-
arguments = ["-Dbuild.compare_friendly=true"]
571-
}
572-
targetBuild {
573-
tasks = ["clean", "assemble"]
574-
// use -Dorg.gradle.java.home= to alter jdk versions
575-
arguments = ["-Dbuild.compare_friendly=true"]
576-
}
577-
}
578-
}
579-
580491
allprojects {
581492
task resolveAllDependencies {
582493
dependsOn tasks.matching { it.name == "pullFixture"}

buildSrc/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ if (project != rootProject) {
148148
distribution project(':distribution:archives:linux-tar')
149149
distribution project(':distribution:archives:oss-linux-tar')
150150
}
151+
152+
// for external projects we want to remove the marker file indicating we are running the Elasticsearch project
153+
processResources {
154+
exclude 'buildSrc.marker'
155+
}
151156

152157
String localDownloads = "${rootProject.buildDir}/local-downloads"
153158
task setupLocalDownloads(type:Copy) {

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

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.elasticsearch.gradle
2020

21+
import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
2122
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
2223
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2324
import groovy.transform.CompileDynamic
@@ -77,7 +78,6 @@ import org.gradle.authentication.http.HttpHeaderAuthentication
7778
import org.gradle.external.javadoc.CoreJavadocOptions
7879
import org.gradle.internal.jvm.Jvm
7980
import org.gradle.language.base.plugins.LifecycleBasePlugin
80-
import org.gradle.process.CommandLineArgumentProvider
8181
import org.gradle.process.ExecResult
8282
import org.gradle.process.ExecSpec
8383
import org.gradle.util.GradleVersion
@@ -259,7 +259,7 @@ class BuildPlugin implements Plugin<Project> {
259259
if (ext.get('buildDocker')) {
260260
(ext.get('requiresDocker') as List<Task>).add(task)
261261
} else {
262-
task.enabled = false
262+
task.onlyIf { false }
263263
}
264264
}
265265

@@ -530,39 +530,43 @@ class BuildPlugin implements Plugin<Project> {
530530
static void configurePomGeneration(Project project) {
531531
// Only works with `enableFeaturePreview('STABLE_PUBLISHING')`
532532
// https://github.com/gradle/gradle/issues/5696#issuecomment-396965185
533-
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom generatePOMTask ->
534-
// The GenerateMavenPom task is aggressive about setting the destination, instead of fighting it,
535-
// just make a copy.
536-
ExtraPropertiesExtension ext = generatePOMTask.extensions.getByType(ExtraPropertiesExtension)
537-
ext.set('pomFileName', null)
538-
generatePOMTask.doLast {
539-
project.copy { CopySpec spec ->
540-
spec.from generatePOMTask.destination
541-
spec.into "${project.buildDir}/distributions"
542-
spec.rename {
543-
ext.has('pomFileName') && ext.get('pomFileName') == null ?
544-
"${project.convention.getPlugin(BasePluginConvention).archivesBaseName}-${project.version}.pom" :
545-
ext.get('pomFileName')
533+
// dummy task to depend on the real pom generation
534+
project.plugins.withType(MavenPublishPlugin).whenPluginAdded {
535+
Task generatePomTask = project.tasks.create("generatePom")
536+
Task assemble = project.tasks.findByName('assemble')
537+
if (assemble) {
538+
assemble.dependsOn(generatePomTask)
539+
}
540+
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom pomTask ->
541+
// The GenerateMavenPom task is aggressive about setting the destination, instead of fighting it,
542+
// just make a copy.
543+
ExtraPropertiesExtension ext = pomTask.extensions.getByType(ExtraPropertiesExtension)
544+
ext.set('pomFileName', null)
545+
pomTask.doLast {
546+
project.copy { CopySpec spec ->
547+
spec.from pomTask.destination
548+
spec.into "${project.buildDir}/distributions"
549+
spec.rename {
550+
ext.has('pomFileName') && ext.get('pomFileName') == null ?
551+
"${project.convention.getPlugin(BasePluginConvention).archivesBaseName}-${project.version}.pom" :
552+
ext.get('pomFileName')
553+
}
546554
}
547555
}
548556
}
549-
// build poms with assemble (if the assemble task exists)
550-
Task assemble = project.tasks.findByName('assemble')
551-
if (assemble && assemble.enabled) {
552-
assemble.dependsOn(generatePOMTask)
553-
}
554-
}
555-
project.plugins.withType(MavenPublishPlugin).whenPluginAdded {
557+
generatePomTask.dependsOn = ['generatePomFileForNebulaPublication']
556558
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
557559
publishing.publications.all { MavenPublication publication -> // we only deal with maven
558560
// add exclusions to the pom directly, for each of the transitive deps of this project's deps
559561
publication.pom.withXml(fixupDependencies(project))
560562
}
561563
project.plugins.withType(ShadowPlugin).whenPluginAdded {
562-
MavenPublication publication = publishing.publications.maybeCreate('nebula', MavenPublication)
564+
MavenPublication publication = publishing.publications.maybeCreate('shadow', MavenPublication)
563565
publication.with {
564-
artifacts = [ project.tasks.getByName('shadowJar') ]
566+
ShadowExtension shadow = project.extensions.getByType(ShadowExtension)
567+
shadow.component(publication)
565568
}
569+
generatePomTask.dependsOn = ['generatePomFileForShadowPublication']
566570
}
567571
}
568572
}
@@ -690,6 +694,15 @@ class BuildPlugin implements Plugin<Project> {
690694
project.tasks.withType(Jar) { Jar jarTask ->
691695
// we put all our distributable files under distributions
692696
jarTask.destinationDir = new File(project.buildDir, 'distributions')
697+
project.plugins.withType(ShadowPlugin).whenPluginAdded {
698+
/*
699+
* Ensure the original jar task places its output in 'libs' so that we don't overwrite it with the shadow jar. We only do
700+
* this for tasks named jar to exclude javadoc and sources jars.
701+
*/
702+
if (jarTask instanceof ShadowJar == false && jarTask.name == JavaPlugin.JAR_TASK_NAME) {
703+
jarTask.destinationDir = new File(project.buildDir, 'libs')
704+
}
705+
}
693706
// fixup the jar manifest
694707
jarTask.doFirst {
695708
// this doFirst is added before the info plugin, therefore it will run
@@ -716,10 +729,6 @@ class BuildPlugin implements Plugin<Project> {
716729
jarTask.manifest.attributes('Change': shortHash)
717730
}
718731
}
719-
// Force manifest entries that change by nature to a constant to be able to compare builds more effectively
720-
if (System.properties.getProperty("build.compare_friendly", "false") == "true") {
721-
jarTask.manifest.getAttributes().clear()
722-
}
723732
}
724733

725734
// add license/notice files
@@ -744,12 +753,6 @@ class BuildPlugin implements Plugin<Project> {
744753
}
745754
}
746755
project.plugins.withType(ShadowPlugin).whenPluginAdded {
747-
/*
748-
* When we use the shadow plugin we entirely replace the
749-
* normal jar with the shadow jar so we no longer want to run
750-
* the jar task.
751-
*/
752-
project.tasks.getByName(JavaPlugin.JAR_TASK_NAME).enabled = false
753756
project.tasks.getByName('shadowJar').configure { ShadowJar shadowJar ->
754757
/*
755758
* Replace the default "shadow" classifier with null
@@ -768,7 +771,6 @@ class BuildPlugin implements Plugin<Project> {
768771
}
769772
// Make sure we assemble the shadow jar
770773
project.tasks.getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn project.tasks.getByName('shadowJar')
771-
project.artifacts.add('apiElements', project.tasks.getByName('shadowJar'))
772774
}
773775
}
774776

@@ -882,6 +884,7 @@ class BuildPlugin implements Plugin<Project> {
882884

883885
project.plugins.withType(ShadowPlugin).whenPluginAdded {
884886
// Test against a shadow jar if we made one
887+
test.classpath -= project.configurations.getByName('bundle')
885888
test.classpath -= project.tasks.getByName('compileJava').outputs.files
886889
test.classpath += project.tasks.getByName('shadowJar').outputs.files
887890

0 commit comments

Comments
 (0)