Skip to content

Commit 5e9ff4c

Browse files
committed
Merge branch 'master' into do-not-open-broken-indices
* master: (414 commits) Set ACK timeout on indices service test Implement byte array reusage in `NioTransport` (elastic#27696) [TEST] Remove leftover ES temp directories before Vagrant tests (elastic#27722) Cleanup split strings by comma method Remove unused import from AliasResolveRoutingIT Add read timeouts to http module (elastic#27713) Fix routing with leading or trailing whitespace remove await fix from FullClusterRestartIT.testRecovery Add missing 's' to tmpdir name (elastic#27721) [Issue-27716]: CONTRIBUTING.md IntelliJ configurations settings are confusing. (elastic#27717) [TEST] Now actually wait for merges Test out of order delivery of append only index and retry with an intermediate delete [TEST] remove code duplications in RequestTests [Tests] Add test for GeoShapeFieldType#setStrategyName (elastic#27703) Remove unused *Commit* classes (elastic#27714) Add test for writer operation buffer accounting (elastic#27707) [TEST] Wait for merging to complete before testing breaker Add Open Index API to the high level REST client (elastic#27574) Correcting some minor typos in comments Add unreleased v5.6.6 version ...
2 parents 1f9c36f + cbba37c commit 5e9ff4c

File tree

1,398 files changed

+43588
-13006
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,398 files changed

+43588
-13006
lines changed

CONTRIBUTING.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,22 @@ IntelliJ users can automatically configure their IDE: `gradle idea`
110110
then `File->New Project From Existing Sources`. Point to the root of
111111
the source directory, select
112112
`Import project from external model->Gradle`, enable
113-
`Use auto-import`. Additionally, in order to run tests directly from
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
113+
`Use auto-import`. In order to run tests directly from
114+
IDEA 2017.2 and above, it is required to disable the IDEA run launcher in order to avoid
115+
`idea_rt.jar` causing "jar hell". This can be achieved by adding the
116116
`-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
117+
option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties).
118+
Alternatively, `idea.no.launcher=true` can be set in 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 (this will require a
121+
restart of IDEA). For IDEA 2017.3 and above, in addition to the JVM option, you will need to go to
122+
`Run->Edit Configurations->...->Defaults->JUnit` and change the value for the `Shorten command line` setting from
123+
`user-local default: none` to `classpath file`. You may also need to [remove `ant-javafx.jar` from your
124+
classpath](https://github.com/elastic/elasticsearch/issues/14348) if that is
123125
reported as a source of jar hell.
124126

127+
To run an instance of elasticsearch from the source code run `gradle run`
128+
125129
The Elasticsearch codebase makes heavy use of Java `assert`s and the
126130
test runner requires that assertions be enabled within the JVM. This
127131
can be accomplished by passing the flag `-ea` to the JVM on startup.
@@ -141,7 +145,7 @@ Please follow these formatting guidelines:
141145
* Disable “auto-format on save” to prevent unnecessary format changes. This makes reviews much harder as it generates unnecessary formatting changes. If your IDE supports formatting only modified chunks that is fine to do.
142146
* Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause the build to fail. Please attempt to tame your IDE so it doesn't make them and please send a PR against this document with instructions for your IDE if it doesn't contain them.
143147
* Eclipse: `Preferences->Java->Code Style->Organize Imports`. There are two boxes labeled "`Number of (static )? imports needed for .*`". Set their values to 99999 or some other absurdly high value.
144-
* IntelliJ: `Preferences->Editor->Code Style->Java->Imports`. There are two configuration options: `Class count to use import with '*'` and `Names count to use static import with '*'`. Set their values to 99999 or some other absurdly high value.
148+
* IntelliJ: `Preferences/Settings->Editor->Code Style->Java->Imports`. There are two configuration options: `Class count to use import with '*'` and `Names count to use static import with '*'`. Set their values to 99999 or some other absurdly high value.
145149
* Don't worry too much about import order. Try not to change it but don't worry about fighting your IDE to stop it from doing so.
146150

147151
To create a distribution from the source, simply run:

README.textile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ In order to create a distribution, simply run the @gradle assemble@ command in t
208208

209209
The distribution for each project will be created under the @build/distributions@ directory in that project.
210210

211-
See the "TESTING":TESTING.asciidoc file for more information about
212-
running the Elasticsearch test suite.
211+
See the "TESTING":TESTING.asciidoc file for more information about running the Elasticsearch test suite.
213212

214213
h3. Upgrading from Elasticsearch 1.x?
215214

TESTING.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ These are the linux flavors the Vagrantfile currently supports:
351351
* debian-9 aka stretch, the current debian stable distribution
352352
* centos-6
353353
* centos-7
354-
* fedora-25
355354
* fedora-26
355+
* fedora-27
356356
* oel-6 aka Oracle Enterprise Linux 6
357357
* oel-7 aka Oracle Enterprise Linux 7
358358
* sles-12
@@ -428,23 +428,23 @@ sudo -E bats $BATS_TESTS/*.bats
428428
You can also use Gradle to prepare the test environment and then starts a single VM:
429429

430430
-------------------------------------------------
431-
gradle vagrantFedora25#up
431+
gradle vagrantFedora27#up
432432
-------------------------------------------------
433433

434434
Or any of vagrantCentos6#up, vagrantCentos7#up, vagrantDebian8#up,
435-
vagrantFedora25#up, vagrantOel6#up, vagrantOel7#up, vagrantOpensuse13#up,
436-
vagrantSles12#up, vagrantUbuntu1404#up, vagrantUbuntu1604#up.
435+
vagrantDebian9#up, vagrantFedora26#up, vagrantFedora27#up, vagrantOel6#up, vagrantOel7#up,
436+
vagrantOpensuse42#up,vagrantSles12#up, vagrantUbuntu1404#up, vagrantUbuntu1604#up.
437437

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

440440
-------------------------------------------------
441-
vagrant ssh fedora-25
441+
vagrant ssh fedora-27
442442
-------------------------------------------------
443443

444444
Or from another directory:
445445

446446
-------------------------------------------------
447-
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-25
447+
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-27
448448
-------------------------------------------------
449449

450450
Note: Starting vagrant VM outside of the elasticsearch folder requires to

Vagrantfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ Vagrant.configure(2) do |config|
6060
config.vm.box = "elastic/oraclelinux-7-x86_64"
6161
rpm_common config
6262
end
63-
config.vm.define "fedora-25" do |config|
64-
config.vm.box = "elastic/fedora-25-x86_64"
65-
dnf_common config
66-
end
6763
config.vm.define "fedora-26" do |config|
6864
config.vm.box = "elastic/fedora-26-x86_64"
6965
dnf_common config
7066
end
67+
config.vm.define "fedora-27" do |config|
68+
config.vm.box = "elastic/fedora-27-x86_64"
69+
dnf_common config
70+
end
7171
config.vm.define "opensuse-42" do |config|
7272
config.vm.box = "elastic/opensuse-42-x86_64"
7373
opensuse_common config
@@ -307,4 +307,9 @@ Defaults env_keep += "BATS_ARCHIVES"
307307
SUDOERS_VARS
308308
chmod 0440 /etc/sudoers.d/elasticsearch_vars
309309
SHELL
310+
# This prevents leftovers from previous tests using the
311+
# same VM from messing up the current test
312+
config.vm.provision "clean_tmp", run: "always", type: "shell", inline: <<-SHELL
313+
rm -rf /tmp/elasticsearch*
314+
SHELL
310315
end

build.gradle

Lines changed: 27 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
* under the License.
1818
*/
1919

20-
import java.nio.file.Path
21-
import java.util.regex.Matcher
22-
import org.eclipse.jgit.lib.Repository
23-
import org.eclipse.jgit.lib.RepositoryBuilder
24-
import org.gradle.plugins.ide.eclipse.model.SourceFolder
20+
2521
import org.apache.tools.ant.taskdefs.condition.Os
2622
import org.elasticsearch.gradle.BuildPlugin
27-
import org.elasticsearch.gradle.VersionProperties
2823
import org.elasticsearch.gradle.Version
24+
import org.elasticsearch.gradle.VersionCollection
25+
import org.elasticsearch.gradle.VersionProperties
26+
import org.gradle.plugins.ide.eclipse.model.SourceFolder
27+
28+
import java.nio.file.Path
2929

3030
// common maven publishing configuration
3131
subprojects {
@@ -67,64 +67,16 @@ configure(subprojects.findAll { it.projectDir.toPath().startsWith(rootPath) }) {
6767
}
6868
}
6969

70-
/* Introspect all versions of ES that may be tested agains for backwards
70+
/* Introspect all versions of ES that may be tested against for backwards
7171
* compatibility. It is *super* important that this logic is the same as the
7272
* logic in VersionUtils.java, throwing out alphas because they don't have any
7373
* backwards compatibility guarantees and only keeping the latest beta or rc
7474
* in a branch if there are only betas and rcs in the branch so we have
7575
* *something* to test against. */
76-
Version currentVersion = Version.fromString(VersionProperties.elasticsearch.minus('-SNAPSHOT'))
77-
int prevMajor = currentVersion.major - 1
78-
File versionFile = file('core/src/main/java/org/elasticsearch/Version.java')
79-
List<String> versionLines = versionFile.readLines('UTF-8')
80-
List<Version> versions = []
81-
// keep track of the previous major version's last minor, so we know where wire compat begins
82-
int prevMinorIndex = -1 // index in the versions list of the last minor from the prev major
83-
int lastPrevMinor = -1 // the minor version number from the prev major we most recently seen
84-
for (String line : versionLines) {
85-
/* Note that this skips alphas and betas which is fine because they aren't
86-
* compatible with anything. */
87-
Matcher match = line =~ /\W+public static final Version V_(\d+)_(\d+)_(\d+)(_beta\d+|_rc\d+)? .*/
88-
if (match.matches()) {
89-
int major = Integer.parseInt(match.group(1))
90-
int minor = Integer.parseInt(match.group(2))
91-
int bugfix = Integer.parseInt(match.group(3))
92-
String suffix = (match.group(4) ?: '').replace('_', '-')
93-
Version foundVersion = new Version(major, minor, bugfix, suffix, false)
94-
if (currentVersion != foundVersion
95-
&& (major == prevMajor || major == currentVersion.major)) {
96-
if (versions.isEmpty() || versions.last() != foundVersion) {
97-
versions.add(foundVersion)
98-
} else {
99-
// Replace the earlier betas with later ones
100-
Version last = versions.set(versions.size() - 1, foundVersion)
101-
if (last.suffix == '') {
102-
throw new InvalidUserDataException("Found two equal versions but"
103-
+ " the first one [$last] wasn't a beta.")
104-
}
105-
}
106-
if (major == prevMajor && minor > lastPrevMinor) {
107-
prevMinorIndex = versions.size() - 1
108-
lastPrevMinor = minor
109-
}
110-
}
111-
}
112-
}
113-
if (versions.toSorted { it.id } != versions) {
114-
println "Versions: ${versions}"
115-
throw new GradleException("Versions.java contains out of order version constants")
116-
}
117-
if (currentVersion.bugfix == 0) {
118-
// If on a release branch, after the initial release of that branch, the bugfix version will
119-
// be bumped, and will be != 0. On master and N.x branches, we want to test against the
120-
// unreleased version of closest branch. So for those cases, the version includes -SNAPSHOT,
121-
// and the bwc distribution will checkout and build that version.
122-
Version last = versions[-1]
123-
versions[-1] = new Version(last.major, last.minor, last.bugfix, last.suffix, true)
124-
if (last.bugfix == 0) {
125-
versions[-2] = new Version(
126-
versions[-2].major, versions[-2].minor, versions[-2].bugfix, versions[-2].suffix, true)
127-
}
76+
VersionCollection versions = new VersionCollection(file('core/src/main/java/org/elasticsearch/Version.java').readLines('UTF-8'))
77+
if (versions.currentVersion.toString() != VersionProperties.elasticsearch) {
78+
throw new GradleException("The last version in Versions.java [${versions.currentVersion}] does not match " +
79+
"VersionProperties.elasticsearch [${VersionProperties.elasticsearch}]")
12880
}
12981

13082
// build metadata from previous build, contains eg hashes for bwc builds
@@ -143,9 +95,10 @@ allprojects {
14395
// for ide hacks...
14496
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
14597
isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea')
146-
// for backcompat testing
147-
indexCompatVersions = versions
148-
wireCompatVersions = versions.subList(prevMinorIndex, versions.size())
98+
99+
// for BWC testing
100+
versionCollection = versions
101+
149102
buildMetadata = buildMetadataMap
150103
}
151104
}
@@ -163,13 +116,13 @@ task verifyVersions {
163116
Set<Version> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ }.collect { Version.fromString(it) })
164117

165118
// Limit the known versions to those that should be index compatible, and are not future versions
166-
knownVersions = knownVersions.findAll { it.major >= prevMajor && it.before(VersionProperties.elasticsearch) }
119+
knownVersions = knownVersions.findAll { it.major >= versions.currentVersion.major - 1 && it.before(VersionProperties.elasticsearch) }
167120

168121
/* Limit the listed versions to those that have been marked as released.
169122
* Versions not marked as released don't get the same testing and we want
170123
* to make sure that we flip all unreleased versions to released as soon
171124
* as possible after release. */
172-
Set<Version> actualVersions = new TreeSet<>(indexCompatVersions.findAll { false == it.snapshot })
125+
Set<Version> actualVersions = new TreeSet<>(versions.versionsIndexCompatibleWithCurrent.findAll { false == it.snapshot })
173126

174127
// Finally, compare!
175128
if (knownVersions.equals(actualVersions) == false) {
@@ -223,6 +176,7 @@ subprojects {
223176
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
224177
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
225178
"org.elasticsearch:elasticsearch:${version}": ':core',
179+
"org.elasticsearch:elasticsearch-cli:${version}": ':core:cli',
226180
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
227181
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',
228182
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
@@ -243,25 +197,17 @@ subprojects {
243197
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
244198
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
245199
]
246-
if (indexCompatVersions[-1].snapshot) {
247-
/* The last and second to last versions can be snapshots. Rather than use
248-
* snapshots built by CI we connect these versions to projects that build
249-
* those those versions from the HEAD of the appropriate branch. */
250-
if (indexCompatVersions[-1].bugfix == 0) {
251-
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
252-
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
253-
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
254-
if (indexCompatVersions.size() > 1) {
255-
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
256-
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
257-
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
258-
}
259-
} else {
260-
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
261-
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
262-
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
200+
201+
for (final Version version : versionCollection.versionsIndexCompatibleWithCurrent) {
202+
if (version.branch != null) {
203+
final String snapshotProject = ":distribution:bwc-snapshot-${version.branch}"
204+
project(snapshotProject).ext.bwcVersion = version
205+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${version}"] = snapshotProject
206+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${version}"] = snapshotProject
207+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${version}"] = snapshotProject
263208
}
264209
}
210+
265211
project.afterEvaluate {
266212
configurations.all {
267213
resolutionStrategy.dependencySubstitution { DependencySubstitutions subs ->

buildSrc/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import java.nio.file.Files
2121

22+
import org.gradle.util.GradleVersion
23+
2224
apply plugin: 'groovy'
2325

2426
group = 'org.elasticsearch.gradle'
@@ -99,9 +101,11 @@ dependencies {
99101

100102
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
101103
// Use logging dependency instead
104+
// Gradle 4.3.1 stopped releasing the logging jars to jcenter, just use the last available one
105+
GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3') ? GradleVersion.version('4.3') : GradleVersion.current()
102106

103107
dependencies {
104-
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
108+
compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}"
105109
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
106110
}
107111

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ class BuildPlugin implements Plugin<Project> {
123123
}
124124
println " Random Testing Seed : ${project.testSeed}"
125125

126-
// enforce gradle version
127-
GradleVersion minGradle = GradleVersion.version('3.3')
128-
if (GradleVersion.current() < minGradle) {
126+
// enforce Gradle version
127+
final GradleVersion currentGradleVersion = GradleVersion.current();
128+
129+
final GradleVersion minGradle = GradleVersion.version('3.3')
130+
if (currentGradleVersion < minGradle) {
129131
throw new GradleException("${minGradle} or above is required to build elasticsearch")
130132
}
131133

@@ -231,7 +233,7 @@ class BuildPlugin implements Plugin<Project> {
231233

232234
/** Return the configuration name used for finding transitive deps of the given dependency. */
233235
private static String transitiveDepConfigName(String groupId, String artifactId, String version) {
234-
return "_transitive_${groupId}:${artifactId}:${version}"
236+
return "_transitive_${groupId}_${artifactId}_${version}"
235237
}
236238

237239
/**

0 commit comments

Comments
 (0)