Skip to content

Commit 6bb1d2c

Browse files
committed
Merge branch 'master' into pr/23767
* master: (356 commits) Do not set SO_LINGER on server channels (elastic#26997) Fix inconsistencies in the rest api specs for *_script (elastic#26971) fix inconsistencies in the rest api specs for cat.snapshots (elastic#26996) Add docs on full_id parameter in cat nodes API [TEST] Add test that replicates versioned updates with random flushes Use internal searcher for all indexing related operations in the engine Reformat paragraph in template docs to 80 columns Clarify settings and template on create index Fix reference to TcpTransport in documentation Allow Uid#decodeId to decode from a byte array slice (elastic#26987) Fix a typo in the similarity docs (elastic#26970) Use separate searchers for "search visibility" vs "move indexing buffer to disk (elastic#26972) Create weights lazily in filter and filters aggregation (elastic#26983) Use a dedicated ThreadGroup in rest sniffer (elastic#26897) Fire global checkpoint sync under system context Update by Query is modified to accept short `script` parameter. (elastic#26841) Cat shards bytes (elastic#26952) Add support for parsing inline script (elastic#23824) (elastic#26846) Change default value to true for transpositions parameter of fuzzy query (elastic#26901) Adding unreleased 5.6.4 version number to Version.java ...
2 parents c6ad0cc + 277637f commit 6bb1d2c

File tree

1,389 files changed

+27794
-16291
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,389 files changed

+27794
-16291
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ If you have a bugfix or new feature that you would like to contribute to Elastic
3838

3939
We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code.
4040

41+
Note that it is unlikely the project will merge refactors for the sake of refactoring. These
42+
types of pull requests have a high cost to maintainers in reviewing and testing with little
43+
to no tangible benefit. This especially includes changes generated by tools. For example,
44+
converting all generic interface instances to use the diamond operator.
45+
4146
The process for contributing to any of the [Elastic repositories](https://github.com/elastic/) is similar. Details for individual projects can be found below.
4247

4348
### Fork and clone the repository
@@ -106,9 +111,16 @@ then `File->New Project From Existing Sources`. Point to the root of
106111
the source directory, select
107112
`Import project from external model->Gradle`, enable
108113
`Use auto-import`. Additionally, in order to run tests directly from
109-
IDEA 2017.2 and above it is required to disable IDEA run launcher,
110-
which can be achieved by adding `-Didea.no.launcher=true`
111-
[JVM option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties)
114+
IDEA 2017.2 and above it is required to disable IDEA run launcher to avoid
115+
finding yourself in "jar hell", which can be achieved by adding the
116+
`-Didea.no.launcher=true` [JVM
117+
option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties)
118+
or by adding `idea.no.launcher=true` to the
119+
`idea.properties`[https://www.jetbrains.com/help/idea/file-idea-properties.html]
120+
file which can be accessed under Help > Edit Custom Properties within IDEA. You
121+
may also need to [remove `ant-javafx.jar` from your
122+
classpath][https://github.com/elastic/elasticsearch/issues/14348] if that is
123+
reported as a source of jar hell.
112124

113125
The Elasticsearch codebase makes heavy use of Java `assert`s and the
114126
test runner requires that assertions be enabled within the JVM. This

TESTING.asciidoc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ These are the linux flavors the Vagrantfile currently supports:
352352
* centos-6
353353
* centos-7
354354
* fedora-25
355+
* fedora-26
355356
* oel-6 aka Oracle Enterprise Linux 6
356357
* oel-7 aka Oracle Enterprise Linux 7
357358
* sles-12
@@ -471,28 +472,30 @@ is tested depends on the branch. On master, this will test against the current
471472
stable branch. On the stable branch, it will test against the latest release
472473
branch. Finally, on a release branch, it will test against the most recent release.
473474

474-
=== BWC Testing against a specific branch
475+
=== BWC Testing against a specific remote/branch
475476

476477
Sometimes a backward compatibility change spans two versions. A common case is a new functionality
477478
that needs a BWC bridge in and an unreleased versioned of a release branch (for example, 5.x).
478-
To test the changes, you can instruct gradle to build the BWC version from a local branch instead of
479-
pulling the release branch from GitHub. You do so using the `tests.bwc.refspec` system property:
479+
To test the changes, you can instruct gradle to build the BWC version from a another remote/branch combination instead of
480+
pulling the release branch from GitHub. You do so using the `tests.bwc.remote` and `tests.bwc.refspec` system properties:
480481

481482
-------------------------------------------------
482-
gradle check -Dtests.bwc.refspec=origin/index_req_bwc_5.x
483+
gradle check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec=index_req_bwc_5.x
483484
-------------------------------------------------
484485

485-
The branch needs to be available on the local clone that the BWC makes of the repository you run the
486-
tests from. Using the `origin` remote is a handy trick to make sure that a branch is available
487-
and is up to date in the case of multiple runs.
486+
The branch needs to be available on the remote that the BWC makes of the
487+
repository you run the tests from. Using the remote is a handy trick to make
488+
sure that a branch is available and is up to date in the case of multiple runs.
488489

489490
Example:
490491

491-
Say you need to make a change to `master` and have a BWC layer in `5.x`. You will need to:
492-
. Create a branch called `index_req_change` off `master`. This will contain your change.
492+
Say you need to make a change to `master` and have a BWC layer in `5.x`. You
493+
will need to:
494+
. Create a branch called `index_req_change` off your remote `${remote}`. This
495+
will contain your change.
493496
. Create a branch called `index_req_bwc_5.x` off `5.x`. This will contain your bwc layer.
494-
. If not running the tests locally, push both branches to your remote repository.
495-
. Run the tests with `gradle check -Dtests.bwc.refspec=origin/index_req_bwc_5.x`
497+
. Push both branches to your remote repository.
498+
. Run the tests with `gradle check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec=index_req_bwc_5.x`.
496499

497500
== Coverage analysis
498501

Vagrantfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ Vagrant.configure(2) do |config|
6464
config.vm.box = "elastic/fedora-25-x86_64"
6565
dnf_common config
6666
end
67+
config.vm.define "fedora-26" do |config|
68+
config.vm.box = "elastic/fedora-26-x86_64"
69+
dnf_common config
70+
end
6771
config.vm.define "opensuse-42" do |config|
6872
config.vm.box = "elastic/opensuse-42-x86_64"
6973
opensuse_common config

build.gradle

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.eclipse.jgit.lib.Repository
2323
import org.eclipse.jgit.lib.RepositoryBuilder
2424
import org.gradle.plugins.ide.eclipse.model.SourceFolder
2525
import org.apache.tools.ant.taskdefs.condition.Os
26+
import org.elasticsearch.gradle.BuildPlugin
2627
import org.elasticsearch.gradle.VersionProperties
2728
import org.elasticsearch.gradle.Version
2829

@@ -60,6 +61,10 @@ configure(subprojects.findAll { it.projectDir.toPath().startsWith(rootPath) }) {
6061
}
6162
}
6263
}
64+
plugins.withType(BuildPlugin).whenPluginAdded {
65+
project.licenseFile = project.rootProject.file('LICENSE.txt')
66+
project.noticeFile = project.rootProject.file('NOTICE.txt')
67+
}
6368
}
6469

6570
/* Introspect all versions of ES that may be tested agains for backwards
@@ -122,6 +127,16 @@ if (currentVersion.bugfix == 0) {
122127
}
123128
}
124129

130+
// build metadata from previous build, contains eg hashes for bwc builds
131+
String buildMetadataValue = System.getenv('BUILD_METADATA')
132+
if (buildMetadataValue == null) {
133+
buildMetadataValue = ''
134+
}
135+
Map<String, String> buildMetadataMap = buildMetadataValue.tokenize(';').collectEntries {
136+
def (String key, String value) = it.split('=')
137+
return [key, value]
138+
}
139+
125140
// injecting groovy property variables into all projects
126141
allprojects {
127142
project.ext {
@@ -131,6 +146,7 @@ allprojects {
131146
// for backcompat testing
132147
indexCompatVersions = versions
133148
wireCompatVersions = versions.subList(prevMinorIndex, versions.size())
149+
buildMetadata = buildMetadataMap
134150
}
135151
}
136152

@@ -188,33 +204,15 @@ task branchConsistency {
188204
}
189205

190206
subprojects {
191-
project.afterEvaluate {
192-
// include license and notice in jars
193-
tasks.withType(Jar) {
194-
into('META-INF') {
195-
from project.rootProject.rootDir
196-
include 'LICENSE.txt'
197-
include 'NOTICE.txt'
198-
}
199-
}
200-
// ignore missing javadocs
201-
tasks.withType(Javadoc) { Javadoc javadoc ->
202-
// the -quiet here is because of a bug in gradle, in that adding a string option
203-
// by itself is not added to the options. By adding quiet, both this option and
204-
// the "value" -quiet is added, separated by a space. This is ok since the javadoc
205-
// command already adds -quiet, so we are just duplicating it
206-
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
207-
javadoc.options.encoding='UTF8'
208-
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
209-
/*
210-
TODO: building javadocs with java 9 b118 is currently broken with weird errors, so
211-
for now this is commented out...try again with the next ea build...
212-
javadoc.executable = new File(project.javaHome, 'bin/javadoc')
213-
if (project.javaVersion == JavaVersion.VERSION_1_9) {
214-
// TODO: remove this hack! gradle should be passing this...
215-
javadoc.options.addStringOption('source', '8')
216-
}*/
217-
}
207+
// ignore missing javadocs
208+
tasks.withType(Javadoc) { Javadoc javadoc ->
209+
// the -quiet here is because of a bug in gradle, in that adding a string option
210+
// by itself is not added to the options. By adding quiet, both this option and
211+
// the "value" -quiet is added, separated by a space. This is ok since the javadoc
212+
// command already adds -quiet, so we are just duplicating it
213+
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
214+
javadoc.options.encoding='UTF8'
215+
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
218216
}
219217

220218
/* Sets up the dependencies that we build as part of this project but
@@ -272,6 +270,27 @@ subprojects {
272270
}
273271
}
274272
}
273+
274+
// Handle javadoc dependencies across projects. Order matters: the linksOffline for
275+
// org.elasticsearch:elasticsearch must be the last one or all the links for the
276+
// other packages (e.g org.elasticsearch.client) will point to core rather than
277+
// their own artifacts.
278+
if (project.plugins.hasPlugin(BuildPlugin)) {
279+
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
280+
Closure sortClosure = { a, b -> b.group <=> a.group }
281+
Closure depJavadocClosure = { dep ->
282+
if (dep.group != null && dep.group.startsWith('org.elasticsearch')) {
283+
String substitution = project.ext.projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
284+
if (substitution != null) {
285+
project.javadoc.dependsOn substitution + ':javadoc'
286+
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
287+
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${project.project(substitution).buildDir}/docs/javadoc/"
288+
}
289+
}
290+
}
291+
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
292+
project.configurations.provided.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
293+
}
275294
}
276295
}
277296

@@ -281,7 +300,7 @@ subprojects {
281300
// the dependency is added.
282301
gradle.projectsEvaluated {
283302
allprojects {
284-
if (project.path == ':test:framework' || project.path == ':client:test') {
303+
if (project.path == ':test:framework') {
285304
// :test:framework:test cannot run before and after :core:test
286305
return
287306
}

buildSrc/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ dependencies {
9292
compile 'com.netflix.nebula:gradle-info-plugin:3.0.3'
9393
compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r'
9494
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
95-
compile 'de.thetaphi:forbiddenapis:2.3'
95+
compile 'de.thetaphi:forbiddenapis:2.4.1'
9696
compile 'org.apache.rat:apache-rat:0.11'
97+
compile "org.elasticsearch:jna:4.4.0-1"
9798
}
9899

99100
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs

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

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import org.gradle.api.Project
3030
import org.gradle.api.Task
3131
import org.gradle.api.XmlProvider
3232
import org.gradle.api.artifacts.Configuration
33-
import org.gradle.api.artifacts.Dependency
3433
import org.gradle.api.artifacts.ModuleDependency
3534
import org.gradle.api.artifacts.ModuleVersionIdentifier
3635
import org.gradle.api.artifacts.ProjectDependency
3736
import org.gradle.api.artifacts.ResolvedArtifact
3837
import org.gradle.api.artifacts.dsl.RepositoryHandler
38+
import org.gradle.api.file.CopySpec
3939
import org.gradle.api.plugins.JavaPlugin
4040
import org.gradle.api.publish.maven.MavenPublication
4141
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
@@ -270,8 +270,8 @@ class BuildPlugin implements Plugin<Project> {
270270
})
271271

272272
// force all dependencies added directly to compile/testCompile to be non-transitive, except for ES itself
273-
Closure disableTransitiveDeps = { Dependency dep ->
274-
if (dep instanceof ModuleDependency && !(dep instanceof ProjectDependency) && dep.group.startsWith('org.elasticsearch') == false) {
273+
Closure disableTransitiveDeps = { ModuleDependency dep ->
274+
if (!(dep instanceof ProjectDependency) && dep.group.startsWith('org.elasticsearch') == false) {
275275
dep.transitive = false
276276

277277
// also create a configuration just for this dependency version, so that later
@@ -455,28 +455,8 @@ class BuildPlugin implements Plugin<Project> {
455455
}
456456

457457
static void configureJavadoc(Project project) {
458-
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
459-
project.afterEvaluate {
460-
project.tasks.withType(Javadoc) {
461-
executable = new File(project.javaHome, 'bin/javadoc')
462-
}
463-
/*
464-
* Order matters, the linksOffline for org.elasticsearch:elasticsearch must be the last one
465-
* or all the links for the other packages (e.g org.elasticsearch.client) will point to core rather than their own artifacts
466-
*/
467-
Closure sortClosure = { a, b -> b.group <=> a.group }
468-
Closure depJavadocClosure = { dep ->
469-
if (dep.group != null && dep.group.startsWith('org.elasticsearch')) {
470-
String substitution = project.ext.projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
471-
if (substitution != null) {
472-
project.javadoc.dependsOn substitution + ':javadoc'
473-
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
474-
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${project.project(substitution).buildDir}/docs/javadoc/"
475-
}
476-
}
477-
}
478-
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
479-
project.configurations.provided.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
458+
project.tasks.withType(Javadoc) {
459+
executable = new File(project.javaHome, 'bin/javadoc')
480460
}
481461
configureJavadocJar(project)
482462
}
@@ -502,6 +482,8 @@ class BuildPlugin implements Plugin<Project> {
502482

503483
/** Adds additional manifest info to jars */
504484
static void configureJars(Project project) {
485+
project.ext.licenseFile = null
486+
project.ext.noticeFile = null
505487
project.tasks.withType(Jar) { Jar jarTask ->
506488
// we put all our distributable files under distributions
507489
jarTask.destinationDir = new File(project.buildDir, 'distributions')
@@ -525,6 +507,20 @@ class BuildPlugin implements Plugin<Project> {
525507
jarTask.manifest.attributes('Change': 'Unknown')
526508
}
527509
}
510+
// add license/notice files
511+
project.afterEvaluate {
512+
if (project.licenseFile == null || project.noticeFile == null) {
513+
throw new GradleException("Must specify license and notice file for project ${project.path}")
514+
}
515+
jarTask.into('META-INF') {
516+
from(project.licenseFile.parent) {
517+
include project.licenseFile.name
518+
}
519+
from(project.noticeFile.parent) {
520+
include project.noticeFile.name
521+
}
522+
}
523+
}
528524
}
529525
}
530526

buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
9393
*
9494
* `sh` snippets that contain `curl` almost always should be marked
9595
* with `// CONSOLE`. In the exceptionally rare cases where they are
96-
* not communicating with Elasticsearch, like the xamples in the ec2
96+
* not communicating with Elasticsearch, like the examples in the ec2
9797
* and gce discovery plugins, the snippets should be marked
9898
* `// NOTCONSOLE`. */
9999
return snippet.language == 'js' || snippet.curl

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class PluginPropertiesExtension {
4646
@Input
4747
boolean hasClientJar = false
4848

49+
/** True if the plugin requires the elasticsearch keystore to exist, false otherwise. */
50+
@Input
51+
boolean requiresKeystore = false
52+
4953
/** A license file that should be included in the built plugin zip. */
5054
@Input
5155
File licenseFile = null

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ class PluginPropertiesTask extends Copy {
8080
'elasticsearchVersion': stringSnap(VersionProperties.elasticsearch),
8181
'javaVersion': project.targetCompatibility as String,
8282
'classname': extension.classname,
83-
'hasNativeController': extension.hasNativeController
83+
'hasNativeController': extension.hasNativeController,
84+
'requiresKeystore': extension.requiresKeystore
8485
]
8586
}
8687
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ public class ForbiddenPatternsTask extends DefaultTask {
6363
patterns.put('nocommit should be all lowercase or all uppercase',
6464
/((?i)nocommit)(?<!(nocommit|NOCOMMIT))/)
6565
patterns.put('tab', /\t/)
66-
if (System.getProperty('build.snapshot', 'true').equals('false')) {
67-
patterns.put('norelease', /norelease|NORELEASE/)
68-
}
69-
patterns.put('norelease should be all lowercase or all uppercase',
70-
/((?i)norelease)(?<!(norelease|NORELEASE))/)
7166

7267

7368
inputs.property("excludes", filesFilter.excludes)

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.apache.tools.ant.DefaultLogger;
2626
import org.apache.tools.ant.Project;
2727
import org.elasticsearch.gradle.AntTask;
2828
import org.gradle.api.artifacts.Configuration;
29-
import org.gradle.api.artifacts.FileCollectionDependency;
3029
import org.gradle.api.file.FileCollection;
3130
import org.gradle.api.tasks.Input
3231
import org.gradle.api.tasks.InputFiles
@@ -86,11 +85,7 @@ public class ThirdPartyAuditTask extends AntTask {
8685

8786
// we only want third party dependencies.
8887
jars = configuration.fileCollection({ dependency ->
89-
// include SelfResolvingDependency with files in the validation
90-
if (dependency instanceof FileCollectionDependency) {
91-
return true
92-
}
93-
return dependency.group && dependency.group.startsWith("org.elasticsearch") == false
88+
dependency.group.startsWith("org.elasticsearch") == false
9489
});
9590

9691
// we don't want provided dependencies, which we have already scanned. e.g. don't

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ class ClusterConfiguration {
6363
boolean debug = false
6464

6565
/**
66-
* if <code>true</code> each node will be configured with <tt>discovery.zen.minimum_master_nodes</tt> set
67-
* to the total number of nodes in the cluster. This will also cause that each node has `0s` state recovery
68-
* timeout which can lead to issues if for instance an existing clusterstate is expected to be recovered
69-
* before any tests start
66+
* Configuration of the setting <tt>discovery.zen.minimum_master_nodes</tt> on the nodes.
67+
* In case of more than one node, this defaults to (number of nodes / 2) + 1
7068
*/
7169
@Input
72-
boolean useMinimumMasterNodes = true
70+
Closure<Integer> minimumMasterNodes = { getNumNodes() > 1 ? getNumNodes().intdiv(2) + 1 : -1 }
7371

7472
@Input
7573
String jvmArgs = "-Xms" + System.getProperty('tests.heap.size', '512m') +

0 commit comments

Comments
 (0)