Skip to content

Commit c7dae3c

Browse files
committed
Merge branch 'master' into thread-pool-info-migration
* master: (110 commits) Remove undocumented action.master.force_local setting (elastic#29351) Enhance error for out of bounds byte size settings (elastic#29338) Fix QueryAnalyzerTests. Fix HasChildQueryBuilderTests to not use the `classic` similarity. [Docs] Correct javadoc of GetIndexRequest (elastic#29364) Make TransportRankEvalAction members final Add awaits fix for a query analyzer test Check presence of multi-types before validating new mapping (elastic#29316) Add awaits fix for HasChildQueryBuilderTests Remove silent batch mode from install plugin (elastic#29359) Align cat thread pool info to thread pool config (elastic#29195) Track Lucene operations in engine explicitly (elastic#29357) Build: Fix Java9 MR build (elastic#29312) Reindex: Fix error in delete-by-query rest spec (elastic#29318) Improve similarity integration. (elastic#29187) Fix some query extraction bugs. (elastic#29283) [Docs] Correct experimental note formatting Move Nullable into core (elastic#29341) [Docs] Update getting-started.asciidoc (elastic#29294) Elasticsearch 6.3.0 is now on Lucene 7.3. ...
2 parents c5ab1b3 + 25d411e commit c7dae3c

File tree

631 files changed

+12119
-6025
lines changed

Some content is hidden

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

631 files changed

+12119
-6025
lines changed

.ci/java-versions.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is used with all of the non-matrix tests in Jenkins.
2+
3+
# This .properties file defines the versions of Java with which to
4+
# build and test Elasticsearch for this branch. Valid Java versions
5+
# are 'java' or 'openjdk' followed by the major release number.
6+
7+
ES_BUILD_JAVA=java10
8+
ES_RUNTIME_JAVA=java8

.ci/matrix-build-javas.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file is used as part of a matrix build in Jenkins where the
2+
# values below are included as an axis of the matrix.
3+
4+
# This axis of the build matrix represents the versions of Java with
5+
# which Elasticsearch will be built. Valid Java versions are 'java'
6+
# or 'openjdk' followed by the major release number.
7+
8+
ES_BUILD_JAVA:
9+
- java10

.ci/matrix-java-exclusions.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is used as part of a matrix build in Jenkins where the
2+
# values below are excluded from the test matrix.
3+
4+
# The yaml mapping below represents a single intersection on the build
5+
# matrix where a test *should not* be run. The value of the exclude
6+
# key is a list of maps.
7+
8+
# In this example all of the combinations defined in the matrix will
9+
# run except for the test that builds with java10 and runs with java8.
10+
# exclude:
11+
# - ES_BUILD_JAVA: java10
12+
# ES_RUNTIME_JAVA: java8
13+
14+
exclude:

.ci/matrix-runtime-javas.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file is used as part of a matrix build in Jenkins where the
2+
# values below are included as an axis of the matrix.
3+
4+
# This axis of the build matrix represents the versions of Java on
5+
# which Elasticsearch will be tested. Valid Java versions are 'java'
6+
# or 'openjdk' followed by the major release number.
7+
8+
ES_RUNTIME_JAVA:
9+
- java8
10+
- java10

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ Contributing to the Elasticsearch codebase
9292

9393
**Repository:** [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch)
9494

95-
JDK 9 is required to build Elasticsearch. You must have a JDK 9 installation
95+
JDK 10 is required to build Elasticsearch. You must have a JDK 10 installation
9696
with the environment variable `JAVA_HOME` referencing the path to Java home for
97-
your JDK 9 installation. By default, tests use the same runtime as `JAVA_HOME`.
97+
your JDK 10 installation. By default, tests use the same runtime as `JAVA_HOME`.
9898
However, since Elasticsearch, supports JDK 8 the build supports compiling with
99-
JDK 9 and testing on a JDK 8 runtime; to do this, set `RUNTIME_JAVA_HOME`
99+
JDK 10 and testing on a JDK 8 runtime; to do this, set `RUNTIME_JAVA_HOME`
100100
pointing to the Java home of a JDK 8 installation. Note that this mechanism can
101101
be used to test against other JDKs as well, this is not only limited to JDK 8.
102102

README.textile

-21
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Elasticsearch is a distributed RESTful search engine built for the cloud. Featur
2727
** All the power of Lucene easily exposed through simple configuration / plugins.
2828
* Per operation consistency
2929
** Single document level operations are atomic, consistent, isolated and durable.
30-
* Open Source under the Apache License, version 2 ("ALv2")
3130

3231
h2. Getting Started
3332

@@ -217,23 +216,3 @@ Elasticsearch (1.x), it is required to perform a full cluster restart. Please
217216
see the "setup reference":
218217
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html
219218
for more details on the upgrade process.
220-
221-
h1. License
222-
223-
<pre>
224-
This software is licensed under the Apache License, version 2 ("ALv2"), quoted below.
225-
226-
Copyright 2009-2016 Elasticsearch <https://www.elastic.co>
227-
228-
Licensed under the Apache License, Version 2.0 (the "License"); you may not
229-
use this file except in compliance with the License. You may obtain a copy of
230-
the License at
231-
232-
http://www.apache.org/licenses/LICENSE-2.0
233-
234-
Unless required by applicable law or agreed to in writing, software
235-
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
236-
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
237-
License for the specific language governing permissions and limitations under
238-
the License.
239-
</pre>

TESTING.asciidoc

+17-29
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ e.g. -Dtests.rest.suite=index,get,create/10_with_id
296296
* `tests.rest.blacklist`: comma separated globs that identify tests that are
297297
blacklisted and need to be skipped
298298
e.g. -Dtests.rest.blacklist=index/*/Index document,get/10_basic/*
299-
* `tests.rest.spec`: REST spec path (default /rest-api-spec/api)
300299

301300
Note that the REST tests, like all the integration tests, can be run against an external
302301
cluster by specifying the `tests.cluster` property, which if present needs to contain a
@@ -414,16 +413,16 @@ and in another window:
414413

415414
----------------------------------------------------
416415
vagrant up centos-7 --provider virtualbox && vagrant ssh centos-7
417-
cd $BATS_ARCHIVES
416+
cd $PACKAGING_ARCHIVES
418417
sudo -E bats $BATS_TESTS/*rpm*.bats
419418
----------------------------------------------------
420419

421420
If you wanted to retest all the release artifacts on a single VM you could:
422421

423422
-------------------------------------------------
424-
./gradlew setupBats
423+
./gradlew setupPackagingTest
425424
cd qa/vagrant; vagrant up ubuntu-1404 --provider virtualbox && vagrant ssh ubuntu-1404
426-
cd $BATS_ARCHIVES
425+
cd $PACKAGING_ARCHIVES
427426
sudo -E bats $BATS_TESTS/*.bats
428427
-------------------------------------------------
429428

@@ -477,12 +476,12 @@ branch. Finally, on a release branch, it will test against the most recent relea
477476
=== BWC Testing against a specific remote/branch
478477

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

484483
-------------------------------------------------
485-
./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec=index_req_bwc_5.x
484+
./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x
486485
-------------------------------------------------
487486

488487
The branch needs to be available on the remote that the BWC makes of the
@@ -497,34 +496,23 @@ will need to:
497496
will contain your change.
498497
. Create a branch called `index_req_bwc_5.x` off `5.x`. This will contain your bwc layer.
499498
. Push both branches to your remote repository.
500-
. Run the tests with `./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec=index_req_bwc_5.x`.
499+
. Run the tests with `./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x`.
501500

502-
== Coverage analysis
501+
== Test coverage analysis
503502

504-
Tests can be run instrumented with jacoco to produce a coverage report in
505-
`target/site/jacoco/`.
503+
Generating test coverage reports for Elasticsearch is currently not possible through Gradle.
504+
However, it _is_ possible to gain insight in code coverage using IntelliJ's built-in coverage
505+
analysis tool that can measure coverage upon executing specific tests. Eclipse may also be able
506+
to do the same using the EclEmma plugin.
506507

507-
Unit test coverage:
508-
509-
---------------------------------------------------------------------------
510-
mvn -Dtests.coverage test jacoco:report
511-
---------------------------------------------------------------------------
512-
513-
Integration test coverage:
514-
515-
---------------------------------------------------------------------------
516-
mvn -Dtests.coverage -Dskip.unit.tests verify jacoco:report
517-
---------------------------------------------------------------------------
518-
519-
Combined (Unit+Integration) coverage:
520-
521-
---------------------------------------------------------------------------
522-
mvn -Dtests.coverage verify jacoco:report
523-
---------------------------------------------------------------------------
508+
Test coverage reporting used to be possible with JaCoCo when Elasticsearch was using Maven
509+
as its build system. Since the switch to Gradle though, this is no longer possible, seeing as
510+
the code currently used to build Elasticsearch does not allow JaCoCo to recognize its tests.
511+
For more information on this, see the discussion in https://github.com/elastic/elasticsearch/issues/28867[issue #28867].
524512

525513
== Launching and debugging from an IDE
526514

527-
If you want to run elasticsearch from your IDE, the `./gradlew run` task
515+
If you want to run Elasticsearch from your IDE, the `./gradlew run` task
528516
supports a remote debugging option:
529517

530518
---------------------------------------------------------------------------

Vagrantfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ export TAR=/elasticsearch/distribution/tar/build/distributions
334334
export RPM=/elasticsearch/distribution/rpm/build/distributions
335335
export DEB=/elasticsearch/distribution/deb/build/distributions
336336
export BATS=/project/build/bats
337-
export BATS_UTILS=/project/build/bats/utils
338-
export BATS_TESTS=/project/build/bats/tests
339-
export BATS_ARCHIVES=/project/build/bats/archives
337+
export BATS_UTILS=/project/build/packaging/bats/utils
338+
export BATS_TESTS=/project/build/packaging/bats/tests
339+
export PACKAGING_ARCHIVES=/project/build/packaging/archives
340340
VARS
341341
cat \<\<SUDOERS_VARS > /etc/sudoers.d/elasticsearch_vars
342342
Defaults env_keep += "ZIP"
@@ -346,7 +346,7 @@ Defaults env_keep += "DEB"
346346
Defaults env_keep += "BATS"
347347
Defaults env_keep += "BATS_UTILS"
348348
Defaults env_keep += "BATS_TESTS"
349-
Defaults env_keep += "BATS_ARCHIVES"
349+
Defaults env_keep += "PACKAGING_ARCHIVES"
350350
SUDOERS_VARS
351351
chmod 0440 /etc/sudoers.d/elasticsearch_vars
352352
SHELL

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ subprojects {
196196
"org.elasticsearch:elasticsearch-cli:${version}": ':server:cli',
197197
"org.elasticsearch:elasticsearch-core:${version}": ':libs:elasticsearch-core',
198198
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:elasticsearch-nio',
199+
"org.elasticsearch:elasticsearch-x-content:${version}": ':libs:x-content',
199200
"org.elasticsearch:elasticsearch-secure-sm:${version}": ':libs:secure-sm',
200201
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
201202
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',

buildSrc/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ dependencies {
9494
compile 'com.netflix.nebula:gradle-info-plugin:3.0.3'
9595
compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r'
9696
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
97-
compile 'de.thetaphi:forbiddenapis:2.4.1'
97+
compile 'de.thetaphi:forbiddenapis:2.5'
9898
compile 'org.apache.rat:apache-rat:0.11'
9999
compile "org.elasticsearch:jna:4.5.1"
100100
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import java.time.ZonedDateTime
5858
class BuildPlugin implements Plugin<Project> {
5959

6060
static final JavaVersion minimumRuntimeVersion = JavaVersion.VERSION_1_8
61-
static final JavaVersion minimumCompilerVersion = JavaVersion.VERSION_1_9
61+
static final JavaVersion minimumCompilerVersion = JavaVersion.VERSION_1_10
6262

6363
@Override
6464
void apply(Project project) {
@@ -311,8 +311,8 @@ class BuildPlugin implements Plugin<Project> {
311311
/** Adds repositories used by ES dependencies */
312312
static void configureRepositories(Project project) {
313313
RepositoryHandler repos = project.repositories
314-
if (System.getProperty("repos.mavenlocal") != null) {
315-
// with -Drepos.mavenlocal=true we can force checking the local .m2 repo which is
314+
if (System.getProperty("repos.mavenLocal") != null) {
315+
// with -Drepos.mavenLocal=true we can force checking the local .m2 repo which is
316316
// useful for development ie. bwc tests where we install stuff in the local repository
317317
// such that we don't have to pass hardcoded files to gradle
318318
repos.mavenLocal()
@@ -551,7 +551,7 @@ class BuildPlugin implements Plugin<Project> {
551551
if (project.licenseFile == null || project.noticeFile == null) {
552552
throw new GradleException("Must specify license and notice file for project ${project.path}")
553553
}
554-
jarTask.into('META-INF') {
554+
jarTask.metaInf {
555555
from(project.licenseFile.parent) {
556556
include project.licenseFile.name
557557
}

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class PluginBuildPlugin extends BuildPlugin {
9595
// we "upgrade" these optional deps to provided for plugins, since they will run
9696
// with a full elasticsearch server that includes optional deps
9797
compileOnly "org.locationtech.spatial4j:spatial4j:${project.versions.spatial4j}"
98-
compileOnly "com.vividsolutions:jts:${project.versions.jts}"
98+
compileOnly "org.locationtech.jts:jts-core:${project.versions.jts}"
9999
compileOnly "org.apache.logging.log4j:log4j-api:${project.versions.log4j}"
100100
compileOnly "org.apache.logging.log4j:log4j-core:${project.versions.log4j}"
101101
compileOnly "org.elasticsearch:jna:${project.versions.jna}"
@@ -168,12 +168,10 @@ public class PluginBuildPlugin extends BuildPlugin {
168168
Files.copy(jarFile.resolveSibling(sourcesFileName), jarFile.resolveSibling(clientSourcesFileName),
169169
StandardCopyOption.REPLACE_EXISTING)
170170

171-
if (project.compilerJavaVersion < JavaVersion.VERSION_1_10) {
172-
String javadocFileName = jarFile.fileName.toString().replace('.jar', '-javadoc.jar')
173-
String clientJavadocFileName = clientFileName.replace('.jar', '-javadoc.jar')
174-
Files.copy(jarFile.resolveSibling(javadocFileName), jarFile.resolveSibling(clientJavadocFileName),
175-
StandardCopyOption.REPLACE_EXISTING)
176-
}
171+
String javadocFileName = jarFile.fileName.toString().replace('.jar', '-javadoc.jar')
172+
String clientJavadocFileName = clientFileName.replace('.jar', '-javadoc.jar')
173+
Files.copy(jarFile.resolveSibling(javadocFileName), jarFile.resolveSibling(clientJavadocFileName),
174+
StandardCopyOption.REPLACE_EXISTING)
177175
}
178176
project.assemble.dependsOn(clientJar)
179177
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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.gradle.precommit
20+
21+
import org.gradle.api.DefaultTask
22+
import org.gradle.api.GradleException
23+
import org.gradle.api.file.FileCollection
24+
import org.gradle.api.tasks.InputFiles
25+
import org.gradle.api.tasks.OutputFile
26+
import org.gradle.api.tasks.SourceSet
27+
import org.gradle.api.tasks.TaskAction
28+
import org.gradle.api.tasks.util.PatternSet
29+
import org.gradle.api.tasks.util.PatternFilterable
30+
import org.apache.tools.ant.taskdefs.condition.Os
31+
32+
import java.nio.file.Files
33+
import java.nio.file.attribute.PosixFilePermission
34+
import java.nio.file.attribute.PosixFileAttributeView
35+
36+
import static java.nio.file.attribute.PosixFilePermission.OTHERS_EXECUTE
37+
import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE
38+
import static java.nio.file.attribute.PosixFilePermission.OWNER_EXECUTE
39+
40+
/**
41+
* Checks source files for correct file permissions.
42+
*/
43+
public class FilePermissionsTask extends DefaultTask {
44+
45+
/** A pattern set of which files should be checked. */
46+
private PatternFilterable filesFilter = new PatternSet()
47+
48+
@OutputFile
49+
File outputMarker = new File(project.buildDir, 'markers/filePermissions')
50+
51+
FilePermissionsTask() {
52+
onlyIf { !Os.isFamily(Os.FAMILY_WINDOWS) }
53+
description = "Checks java source files for correct file permissions"
54+
// we always include all source files, and exclude what should not be checked
55+
filesFilter.include('**')
56+
// exclude sh files that might have the executable bit set
57+
filesFilter.exclude('**/*.sh')
58+
}
59+
60+
/** Returns the files this task will check */
61+
@InputFiles
62+
FileCollection files() {
63+
List<FileCollection> collections = new ArrayList<>()
64+
for (SourceSet sourceSet : project.sourceSets) {
65+
collections.add(sourceSet.allSource.matching(filesFilter))
66+
}
67+
return project.files(collections.toArray())
68+
}
69+
70+
@TaskAction
71+
void checkInvalidPermissions() {
72+
List<String> failures = new ArrayList<>()
73+
for (File f : files()) {
74+
PosixFileAttributeView fileAttributeView = Files.getFileAttributeView(f.toPath(), PosixFileAttributeView.class)
75+
Set<PosixFilePermission> permissions = fileAttributeView.readAttributes().permissions()
76+
if (permissions.contains(OTHERS_EXECUTE) || permissions.contains(OWNER_EXECUTE) ||
77+
permissions.contains(GROUP_EXECUTE)) {
78+
failures.add("Source file is executable: " + f)
79+
}
80+
}
81+
if (failures.isEmpty() == false) {
82+
throw new GradleException('Found invalid file permissions:\n' + failures.join('\n'))
83+
}
84+
outputMarker.setText('done', 'UTF-8')
85+
}
86+
87+
}

0 commit comments

Comments
 (0)