Skip to content

Commit 5e2de34

Browse files
committed
Merge branch 'master' into honor-systemd-sysctl-masking
* master: (619 commits) Add support for clear scroll to high level REST client (elastic#25038) Tiny correction in inner-hits.asciidoc (elastic#25066) Added release notes for 6.0.0-alpha2 Expand index expressions against indices only when managing aliases (elastic#23997) Collapse inner hits rest test should not skip 5.x Settings: Fix secure settings by prefix (elastic#25064) add `exclude_keys` option to KeyValueProcessor (elastic#24876) Test: update missing body tests to run against versions >= 5.5.0 Track EWMA[1] of task execution time in search threadpool executor Removes an invalid assert in resizing big arrays which does not always hold (resizing can result in a smaller size than the current size, while the assert attempted to verify the new size is always greater than the current). Fixed NPEs caused by requests without content. (elastic#23497) Plugins can register pre-configured char filters (elastic#25000) Build: Allow preserving shared dir (elastic#24962) Tests: Make secure settings available from settings builder for tests (elastic#25037) [TEST] Skip wildcard expansion test due to breaking change Test that gradle and Java version types match (elastic#24943) Include duplicate jar when jarhell check fails Change ScriptContexts to use needs instead of uses$. (elastic#25036) Change `has_child`, `has_parent` queries and `childen` aggregation to work with the new join field type and at the same time maintaining support for the `_parent` meta field type. Remove comma-separated feature parsing for GetIndicesAction ...
2 parents f76cdc7 + d47d479 commit 5e2de34

File tree

2,784 files changed

+69342
-41411
lines changed

Some content is hidden

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

2,784 files changed

+69342
-41411
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
<!--
2-
GitHub is reserved for bug reports and feature requests. The best place
3-
to ask a general question is at the Elastic Discourse forums at
4-
https://discuss.elastic.co. If you are in fact posting a bug report or
5-
a feature request, please include one and only one of the below blocks
6-
in your new issue. Note that whether you're filing a bug report or a
7-
feature request, ensure that your submission is for an
8-
[OS that we support](https://www.elastic.co/support/matrix#show_os).
9-
Bug reports on an OS that we do not support or feature requests
10-
specific to an OS that we do not support will be closed.
11-
-->
122
13-
<!--
14-
If you are filing a bug report, please remove the below feature
15-
request block and provide responses for all of the below items.
3+
** Please read the guidelines below. **
4+
5+
Issues that do not follow these guidelines are likely to be closed.
6+
7+
1. GitHub is reserved for bug reports and feature requests. The best place to
8+
ask a general question is at the Elastic [forums](https://discuss.elastic.co).
9+
GitHub is not the place for general questions.
10+
11+
2. Is this bug report or feature request for a supported OS? If not, it
12+
is likely to be closed. See https://www.elastic.co/support/matrix#show_os
13+
14+
3. Please fill out EITHER the feature request block or the bug report block
15+
below, and delete the other block.
16+
1617
-->
1718

19+
<!-- Feature request -->
20+
21+
**Describe the feature**:
22+
23+
<!-- Bug report -->
24+
1825
**Elasticsearch version**:
1926

2027
**Plugins installed**: []
2128

22-
**JVM version**:
29+
**JVM version** (`java -version`):
2330

24-
**OS version**:
31+
**OS version** (`uname -a` if on a Unix-like system):
2532

2633
**Description of the problem including expected versus actual behavior**:
2734

2835
**Steps to reproduce**:
36+
37+
Please include a *minimal* but *complete* recreation of the problem, including
38+
(e.g.) index creation, mappings, settings, query etc. The easier you make for
39+
us to reproduce it, the more likely that somebody will take the time to look at it.
40+
2941
1.
3042
2.
3143
3.
3244

3345
**Provide logs (if relevant)**:
3446

35-
<!--
36-
If you are filing a feature request, please remove the above bug
37-
report block and provide responses for all of the below items.
38-
-->
39-
40-
**Describe the feature**:

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ IntelliJ users can automatically configure their IDE: `gradle idea`
101101
then `File->New Project From Existing Sources`. Point to the root of
102102
the source directory, select
103103
`Import project from external model->Gradle`, enable
104-
`Use auto-import`.
104+
`Use auto-import`. Additionally, in order to run tests directly from
105+
IDEA 2017.1 and above it is required to disable IDEA run launcher,
106+
which can be achieved by adding `-Didea.no.launcher=true`
107+
[JVM option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties)
108+
105109

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

TESTING.asciidoc

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ These are the linux flavors the Vagrantfile currently supports:
350350
* debian-8 aka jessie, the current debian stable distribution
351351
* centos-6
352352
* centos-7
353-
* fedora-24
353+
* fedora-25
354354
* oel-6 aka Oracle Enterprise Linux 6
355355
* oel-7 aka Oracle Enterprise Linux 7
356356
* sles-12
357-
* opensuse-13
357+
* opensuse-42 aka Leap
358358

359359
We're missing the following from the support matrix because there aren't high
360360
quality boxes available in vagrant atlas:
@@ -426,29 +426,49 @@ sudo -E bats $BATS_TESTS/*.bats
426426
You can also use Gradle to prepare the test environment and then starts a single VM:
427427

428428
-------------------------------------------------
429-
gradle vagrantFedora24#up
429+
gradle vagrantFedora25#up
430430
-------------------------------------------------
431431

432-
Or any of vagrantCentos6#up, vagrantDebian8#up, vagrantFedora24#up, vagrantOel6#up,
433-
vagrantOel7#up, vagrantOpensuse13#up, vagrantSles12#up, vagrantUbuntu1404#up,
434-
vagrantUbuntu1604#up.
432+
Or any of vagrantCentos6#up, vagrantCentos7#up, vagrantDebian8#up,
433+
vagrantFedora25#up, vagrantOel6#up, vagrantOel7#up, vagrantOpensuse13#up,
434+
vagrantSles12#up, vagrantUbuntu1404#up, vagrantUbuntu1604#up.
435435

436436
Once up, you can then connect to the VM using SSH from the elasticsearch directory:
437437

438438
-------------------------------------------------
439-
vagrant ssh fedora-24
439+
vagrant ssh fedora-25
440440
-------------------------------------------------
441441

442442
Or from another directory:
443443

444444
-------------------------------------------------
445-
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-24
445+
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-25
446446
-------------------------------------------------
447447

448448
Note: Starting vagrant VM outside of the elasticsearch folder requires to
449449
indicates the folder that contains the Vagrantfile using the VAGRANT_CWD
450450
environment variable.
451451

452+
== Testing backwards compatibility
453+
454+
Backwards compatibility tests exist to test upgrading from each supported version
455+
to the current version. To run all backcompat tests use:
456+
457+
-------------------------------------------------
458+
gradle bwcTest
459+
-------------------------------------------------
460+
461+
A specific version can be tested as well. For example, to test backcompat with
462+
version 5.3.2 run:
463+
464+
-------------------------------------------------
465+
gradle v5.3.2#bwcTest
466+
-------------------------------------------------
467+
468+
When running `gradle check`, some minimal backcompat checks are run. Which version
469+
is tested depends on the branch. On master, this will test against the current
470+
stable branch. On the stable branch, it will test against the latest release
471+
branch. Finally, on a release branch, it will test against the most recent release.
452472

453473
== Coverage analysis
454474

Vagrantfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ Vagrant.configure(2) do |config|
5656
config.vm.box = "elastic/oraclelinux-7-x86_64"
5757
rpm_common config
5858
end
59-
config.vm.define "fedora-24" do |config|
60-
config.vm.box = "elastic/fedora-24-x86_64"
59+
config.vm.define "fedora-25" do |config|
60+
config.vm.box = "elastic/fedora-25-x86_64"
6161
dnf_common config
6262
end
63-
config.vm.define "opensuse-13" do |config|
64-
config.vm.box = "elastic/opensuse-13-x86_64"
63+
config.vm.define "opensuse-42" do |config|
64+
config.vm.box = "elastic/opensuse-42-x86_64"
6565
opensuse_common config
6666
end
6767
config.vm.define "sles-12" do |config|
@@ -104,6 +104,12 @@ SOURCE_PROMPT
104104
source /etc/profile.d/elasticsearch_prompt.sh
105105
SOURCE_PROMPT
106106
SHELL
107+
# Creates a file to mark the machine as created by vagrant. Tests check
108+
# for this file and refuse to run if it is not present so that they can't
109+
# be run unexpectedly.
110+
config.vm.provision "markerfile", type: "shell", inline: <<-SHELL
111+
touch /etc/is_vagrant_vm
112+
SHELL
107113
end
108114
config.config_procs.push ['2', set_prompt]
109115
end
@@ -263,7 +269,7 @@ def provision(config,
263269
echo "==> Installing Gradle"
264270
curl -sS -o /tmp/gradle.zip -L https://services.gradle.org/distributions/gradle-3.3-bin.zip
265271
unzip /tmp/gradle.zip -d /opt
266-
rm -rf /tmp/gradle.zip
272+
rm -rf /tmp/gradle.zip
267273
ln -s /opt/gradle-3.3/bin/gradle /usr/bin/gradle
268274
# make nfs mounted gradle home dir writeable
269275
chown vagrant:vagrant /home/vagrant/.gradle

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import org.elasticsearch.gateway.GatewayAllocator;
3737

3838
import java.lang.reflect.InvocationTargetException;
39-
import java.net.InetAddress;
40-
import java.net.UnknownHostException;
4139
import java.util.Collection;
4240
import java.util.Collections;
4341
import java.util.List;
@@ -49,7 +47,7 @@ private static class NoopGatewayAllocator extends GatewayAllocator {
4947
public static final NoopGatewayAllocator INSTANCE = new NoopGatewayAllocator();
5048

5149
protected NoopGatewayAllocator() {
52-
super(Settings.EMPTY, null, null);
50+
super(Settings.EMPTY);
5351
}
5452

5553
@Override

build.gradle

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.eclipse.jgit.lib.RepositoryBuilder
2424
import org.gradle.plugins.ide.eclipse.model.SourceFolder
2525
import org.apache.tools.ant.taskdefs.condition.Os
2626
import org.elasticsearch.gradle.VersionProperties
27+
import org.elasticsearch.gradle.Version
2728

2829
// common maven publishing configuration
2930
subprojects {
@@ -61,15 +62,52 @@ configure(subprojects.findAll { it.projectDir.toPath().startsWith(rootPath) }) {
6162
}
6263
}
6364

64-
int prevMajor = Integer.parseInt(VersionProperties.elasticsearch.split('\\.')[0]) - 1
65-
String prevSnapshot = VersionProperties.elasticsearch.contains('alpha') ? '-SNAPSHOT' : ''
65+
/* Introspect all versions of ES that may be tested agains for backwards
66+
* compatibility. It is *super* important that this logic is the same as the
67+
* logic in VersionUtils.java, modulo alphas, betas, and rcs which are ignored
68+
* in gradle because they don't have any backwards compatibility guarantees
69+
* but are not ignored in VersionUtils.java because the tests expect them not
70+
* to be. */
71+
Version currentVersion = Version.fromString(VersionProperties.elasticsearch.minus('-SNAPSHOT'))
72+
int prevMajor = currentVersion.major - 1
6673
File versionFile = file('core/src/main/java/org/elasticsearch/Version.java')
6774
List<String> versionLines = versionFile.readLines('UTF-8')
68-
int prevMinor = 0
75+
List<Version> versions = []
76+
// keep track of the previous major version's last minor, so we know where wire compat begins
77+
int prevMinorIndex = -1 // index in the versions list of the last minor from the prev major
78+
int lastPrevMinor = -1 // the minor version number from the prev major we most recently seen
6979
for (String line : versionLines) {
70-
Matcher match = line =~ /\W+public static final Version V_${prevMajor}_(\d+)_.*/
80+
/* Note that this skips alphas and betas which is fine because they aren't
81+
* compatible with anything. */
82+
Matcher match = line =~ /\W+public static final Version V_(\d+)_(\d+)_(\d+) .*/
7183
if (match.matches()) {
72-
prevMinor = Math.max(Integer.parseInt(match.group(1)), prevMinor)
84+
int major = Integer.parseInt(match.group(1))
85+
int minor = Integer.parseInt(match.group(2))
86+
int bugfix = Integer.parseInt(match.group(3))
87+
Version foundVersion = new Version(major, minor, bugfix, false)
88+
if (currentVersion != foundVersion) {
89+
versions.add(foundVersion)
90+
}
91+
if (major == prevMajor && minor > lastPrevMinor) {
92+
prevMinorIndex = versions.size() - 1
93+
lastPrevMinor = minor
94+
}
95+
}
96+
}
97+
if (versions.toSorted { it.id } != versions) {
98+
println "Versions: ${versions}"
99+
throw new GradleException("Versions.java contains out of order version constants")
100+
}
101+
if (currentVersion.bugfix == 0) {
102+
// If on a release branch, after the initial release of that branch, the bugfix version will
103+
// be bumped, and will be != 0. On master and N.x branches, we want to test against the
104+
// unreleased version of closest branch. So for those cases, the version includes -SNAPSHOT,
105+
// and the bwc distribution will checkout and build that version.
106+
Version last = versions[-1]
107+
versions[-1] = new Version(last.major, last.minor, last.bugfix, true)
108+
if (last.bugfix == 0) {
109+
versions[-2] = new Version(
110+
versions[-2].major, versions[-2].minor, versions[-2].bugfix, true)
73111
}
74112
}
75113

@@ -80,10 +118,46 @@ allprojects {
80118
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
81119
isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea')
82120
// for backcompat testing
83-
bwcVersion = "${prevMajor}.${prevMinor}.0${prevSnapshot}"
121+
indexCompatVersions = versions
122+
wireCompatVersions = versions.subList(prevMinorIndex, versions.size())
123+
}
124+
}
125+
126+
task verifyVersions {
127+
doLast {
128+
if (gradle.startParameter.isOffline()) {
129+
throw new GradleException("Must run in online mode to verify versions")
130+
}
131+
// Read the list from maven central
132+
Node xml
133+
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
134+
xml = new XmlParser().parse(s)
135+
}
136+
Set<Version> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ }.collect { Version.fromString(it) })
137+
138+
// Limit the known versions to those that should be index compatible, and are not future versions
139+
knownVersions = knownVersions.findAll { it.major >= prevMajor && it.before(VersionProperties.elasticsearch) }
140+
141+
/* Limit the listed versions to those that have been marked as released.
142+
* Versions not marked as released don't get the same testing and we want
143+
* to make sure that we flip all unreleased versions to released as soon
144+
* as possible after release. */
145+
Set<Version> actualVersions = new TreeSet<>(indexCompatVersions.findAll { false == it.snapshot })
146+
147+
// Finally, compare!
148+
if (knownVersions.equals(actualVersions) == false) {
149+
throw new GradleException("out-of-date released versions\nActual :" + actualVersions + "\nExpected:" + knownVersions +
150+
"\nUpdate Version.java. Note that Version.CURRENT doesn't count because it is not released.")
151+
}
84152
}
85153
}
86154

155+
task branchConsistency {
156+
description 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
157+
group 'Verification'
158+
dependsOn verifyVersions
159+
}
160+
87161
subprojects {
88162
project.afterEvaluate {
89163
// include license and notice in jars
@@ -128,7 +202,6 @@ subprojects {
128202
"org.elasticsearch.client:transport:${version}": ':client:transport',
129203
"org.elasticsearch.test:framework:${version}": ':test:framework',
130204
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:integ-test-zip',
131-
"org.elasticsearch.distribution.zip:elasticsearch:${bwcVersion}": ':distribution:bwc-zip',
132205
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:zip',
133206
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:tar',
134207
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:rpm',
@@ -138,8 +211,27 @@ subprojects {
138211
"org.elasticsearch.plugin:transport-netty4-client:${version}": ':modules:transport-netty4',
139212
"org.elasticsearch.plugin:reindex-client:${version}": ':modules:reindex',
140213
"org.elasticsearch.plugin:lang-mustache-client:${version}": ':modules:lang-mustache',
214+
"org.elasticsearch.plugin:parent-join-client:${version}": ':modules:parent-join',
215+
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
141216
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
142217
]
218+
if (indexCompatVersions[-1].snapshot) {
219+
/* The last and second to last versions can be snapshots. Rather than use
220+
* snapshots built by CI we connect these versions to projects that build
221+
* those those versions from the HEAD of the appropriate branch. */
222+
if (indexCompatVersions[-1].bugfix == 0) {
223+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
224+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
225+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
226+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
227+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
228+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
229+
} else {
230+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
231+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
232+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
233+
}
234+
}
143235
project.afterEvaluate {
144236
configurations.all {
145237
resolutionStrategy.dependencySubstitution { DependencySubstitutions subs ->

buildSrc/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,11 @@ if (project != rootProject) {
156156
testClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$UnitTestCase'
157157
integTestClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$IntegTestCase'
158158
}
159+
160+
task namingConventionsMain(type: org.elasticsearch.gradle.precommit.NamingConventionsTask) {
161+
checkForTestsInMain = true
162+
testClass = namingConventions.testClass
163+
integTestClass = namingConventions.integTestClass
164+
}
165+
precommit.dependsOn namingConventionsMain
159166
}

0 commit comments

Comments
 (0)