Skip to content

Commit 58591f2

Browse files
committed
Merge branch 'master' into ccr
* master: (31 commits) [TEST] Fix `GeoShapeQueryTests#testPointsOnly` failure Transition transport apis to use void listeners (#27440) AwaitsFix GeoShapeQueryTests#testPointsOnly #27454 Bump test version after backport Ensure nested documents have consistent version and seq_ids (#27455) Tests: Add Fedora-27 to packaging tests Delete some seemingly unused exceptions (#27439) #26800: Fix docs rendering Remove config prompting for secrets and text (#27216) Move the CLI into its own subproject (#27114) Correct usage of "an" to "a" in getting started docs Avoid NPE when getting build information Removes BWC snapshot status handler used in 6.x (#27443) Remove manual tracking of registered channels (#27445) Remove parameters on HandshakeResponseHandler (#27444) [GEO] fix pointsOnly bug for MULTIPOINT Standardize underscore requirements in parameters (#27414) peanut butter hamburgers Log primary-replica resync failures Uses TransportMasterNodeAction to update shard snapshot status (#27165) ...
2 parents c1e2257 + 093218e commit 58591f2

File tree

120 files changed

+1590
-1143
lines changed

Some content is hidden

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

120 files changed

+1590
-1143
lines changed

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: 4 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

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ List<Version> versions = []
8181
// keep track of the previous major version's last minor, so we know where wire compat begins
8282
int prevMinorIndex = -1 // index in the versions list of the last minor from the prev major
8383
int lastPrevMinor = -1 // the minor version number from the prev major we most recently seen
84+
int prevBugfixIndex = -1 // index in the versions list of the last bugfix release from the prev major
8485
for (String line : versionLines) {
8586
/* Note that this skips alphas and betas which is fine because they aren't
8687
* compatible with anything. */
@@ -108,12 +109,19 @@ for (String line : versionLines) {
108109
lastPrevMinor = minor
109110
}
110111
}
112+
if (major == prevMajor) {
113+
prevBugfixIndex = versions.size() - 1
114+
}
111115
}
112116
}
113117
if (versions.toSorted { it.id } != versions) {
114118
println "Versions: ${versions}"
115119
throw new GradleException("Versions.java contains out of order version constants")
116120
}
121+
if (prevBugfixIndex != -1) {
122+
versions[prevBugfixIndex] = new Version(versions[prevBugfixIndex].major, versions[prevBugfixIndex].minor,
123+
versions[prevBugfixIndex].bugfix, versions[prevBugfixIndex].suffix, true)
124+
}
117125
if (currentVersion.bugfix == 0) {
118126
// If on a release branch, after the initial release of that branch, the bugfix version will
119127
// be bumped, and will be != 0. On master and N.x branches, we want to test against the
@@ -223,6 +231,7 @@ subprojects {
223231
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
224232
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
225233
"org.elasticsearch:elasticsearch:${version}": ':core',
234+
"org.elasticsearch:elasticsearch-cli:${version}": ':core:cli',
226235
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
227236
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',
228237
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
@@ -262,6 +271,11 @@ subprojects {
262271
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
263272
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
264273
}
274+
} else if (indexCompatVersions[-2].snapshot) {
275+
/* This is a terrible hack for the bump to 6.0.1 which will be fixed by #27397 */
276+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
277+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
278+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
265279
}
266280
project.afterEvaluate {
267281
configurations.all {

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class VagrantTestPlugin implements Plugin<Project> {
1919
'centos-7',
2020
'debian-8',
2121
'debian-9',
22-
'fedora-25',
2322
'fedora-26',
23+
'fedora-27',
2424
'oel-6',
2525
'oel-7',
2626
'opensuse-42',

client/rest-high-level/src/main/java/org/elasticsearch/client/Request.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,23 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
191191
metadata.field("_id", request.id());
192192
}
193193
if (Strings.hasLength(request.routing())) {
194-
metadata.field("_routing", request.routing());
194+
metadata.field("routing", request.routing());
195195
}
196196
if (Strings.hasLength(request.parent())) {
197-
metadata.field("_parent", request.parent());
197+
metadata.field("parent", request.parent());
198198
}
199199
if (request.version() != Versions.MATCH_ANY) {
200-
metadata.field("_version", request.version());
200+
metadata.field("version", request.version());
201201
}
202202

203203
VersionType versionType = request.versionType();
204204
if (versionType != VersionType.INTERNAL) {
205205
if (versionType == VersionType.EXTERNAL) {
206-
metadata.field("_version_type", "external");
206+
metadata.field("version_type", "external");
207207
} else if (versionType == VersionType.EXTERNAL_GTE) {
208-
metadata.field("_version_type", "external_gte");
208+
metadata.field("version_type", "external_gte");
209209
} else if (versionType == VersionType.FORCE) {
210-
metadata.field("_version_type", "force");
210+
metadata.field("version_type", "force");
211211
}
212212
}
213213

@@ -219,7 +219,7 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
219219
} else if (opType == DocWriteRequest.OpType.UPDATE) {
220220
UpdateRequest updateRequest = (UpdateRequest) request;
221221
if (updateRequest.retryOnConflict() > 0) {
222-
metadata.field("_retry_on_conflict", updateRequest.retryOnConflict());
222+
metadata.field("retry_on_conflict", updateRequest.retryOnConflict());
223223
}
224224
if (updateRequest.fetchSource() != null) {
225225
metadata.field("_source", updateRequest.fetchSource());

core/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies {
5858
compile 'org.elasticsearch:securesm:1.1'
5959

6060
// utilities
61-
compile 'net.sf.jopt-simple:jopt-simple:5.0.2'
61+
compile "org.elasticsearch:elasticsearch-cli:${version}"
6262
compile 'com.carrotsearch:hppc:0.7.1'
6363

6464
// time handling, remove with java 8 time
@@ -265,6 +265,12 @@ if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
265265
dependencyLicenses {
266266
mapping from: /lucene-.*/, to: 'lucene'
267267
mapping from: /jackson-.*/, to: 'jackson'
268+
dependencies = project.configurations.runtime.fileCollection {
269+
it.group.startsWith('org.elasticsearch') == false ||
270+
// keep the following org.elasticsearch jars in
271+
(it.name == 'jna' ||
272+
it.name == 'securesm')
273+
}
268274
}
269275

270276
if (isEclipse == false || project.path == ":core-tests") {

core/cli/build.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
20+
import org.elasticsearch.gradle.precommit.PrecommitTasks
21+
22+
apply plugin: 'elasticsearch.build'
23+
24+
archivesBaseName = 'elasticsearch-cli'
25+
26+
dependencies {
27+
compile 'net.sf.jopt-simple:jopt-simple:5.0.2'
28+
}
29+
30+
test.enabled = false
31+
// Since CLI does not depend on :core, it cannot run the jarHell task
32+
jarHell.enabled = false
33+
34+
forbiddenApisMain {
35+
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
36+
}

core/src/main/java/org/elasticsearch/cli/Command.java renamed to core/cli/src/main/java/org/elasticsearch/cli/Command.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
import joptsimple.OptionParser;
2424
import joptsimple.OptionSet;
2525
import joptsimple.OptionSpec;
26-
import org.apache.logging.log4j.Level;
27-
import org.apache.lucene.util.SetOnce;
28-
import org.elasticsearch.common.SuppressForbidden;
29-
import org.elasticsearch.common.logging.LogConfigurator;
30-
import org.elasticsearch.common.settings.Settings;
3126

3227
import java.io.Closeable;
3328
import java.io.IOException;
@@ -55,12 +50,13 @@ public Command(String description) {
5550
this.description = description;
5651
}
5752

58-
final SetOnce<Thread> shutdownHookThread = new SetOnce<>();
53+
private Thread shutdownHookThread;
5954

6055
/** Parses options for this command from args and executes it. */
6156
public final int main(String[] args, Terminal terminal) throws Exception {
6257
if (addShutdownHook()) {
63-
shutdownHookThread.set(new Thread(() -> {
58+
59+
shutdownHookThread = new Thread(() -> {
6460
try {
6561
this.close();
6662
} catch (final IOException e) {
@@ -75,16 +71,11 @@ public final int main(String[] args, Terminal terminal) throws Exception {
7571
throw new AssertionError(impossible);
7672
}
7773
}
78-
}));
79-
Runtime.getRuntime().addShutdownHook(shutdownHookThread.get());
74+
});
75+
Runtime.getRuntime().addShutdownHook(shutdownHookThread);
8076
}
8177

82-
if (shouldConfigureLoggingWithoutConfig()) {
83-
// initialize default for es.logger.level because we will not read the log4j2.properties
84-
final String loggerLevel = System.getProperty("es.logger.level", Level.INFO.name());
85-
final Settings settings = Settings.builder().put("logger.level", loggerLevel).build();
86-
LogConfigurator.configureWithoutConfig(settings);
87-
}
78+
beforeExecute();
8879

8980
try {
9081
mainWithoutErrorHandling(args, terminal);
@@ -103,14 +94,10 @@ public final int main(String[] args, Terminal terminal) throws Exception {
10394
}
10495

10596
/**
106-
* Indicate whether or not logging should be configured without reading a log4j2.properties. Most commands should do this because we do
107-
* not configure logging for CLI tools. Only commands that configure logging on their own should not do this.
108-
*
109-
* @return true if logging should be configured without reading a log4j2.properties file
97+
* Setup method to be executed before parsing or execution of the command being run. Any exceptions thrown by the
98+
* method will not be cleanly caught by the parser.
11099
*/
111-
protected boolean shouldConfigureLoggingWithoutConfig() {
112-
return true;
113-
}
100+
protected void beforeExecute() {}
114101

115102
/**
116103
* Executes the command, but all errors are thrown.
@@ -166,6 +153,11 @@ protected boolean addShutdownHook() {
166153
return true;
167154
}
168155

156+
/** Gets the shutdown hook thread if it exists **/
157+
Thread getShutdownHookThread() {
158+
return shutdownHookThread;
159+
}
160+
169161
@Override
170162
public void close() throws IOException {
171163

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.cli;
20+
21+
import java.lang.annotation.ElementType;
22+
import java.lang.annotation.Retention;
23+
import java.lang.annotation.RetentionPolicy;
24+
import java.lang.annotation.Target;
25+
26+
/**
27+
* Annotation to suppress forbidden-apis errors inside a whole class, a method, or a field.
28+
*/
29+
@Retention(RetentionPolicy.CLASS)
30+
@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
31+
public @interface SuppressForbidden {
32+
String reason();
33+
}
34+

core/src/main/java/org/elasticsearch/cli/Terminal.java renamed to core/cli/src/main/java/org/elasticsearch/cli/Terminal.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
package org.elasticsearch.cli;
2121

22-
import org.elasticsearch.common.SuppressForbidden;
23-
2422
import java.io.BufferedReader;
2523
import java.io.Console;
2624
import java.io.IOException;

core/src/main/java/org/elasticsearch/Build.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.io.IOException;
2828
import java.net.URL;
29+
import java.security.CodeSource;
2930
import java.util.jar.JarInputStream;
3031
import java.util.jar.Manifest;
3132

@@ -45,8 +46,8 @@ public class Build {
4546
final boolean isSnapshot;
4647

4748
final String esPrefix = "elasticsearch-" + Version.CURRENT;
48-
final URL url = getElasticsearchCodebase();
49-
final String urlStr = url.toString();
49+
final URL url = getElasticsearchCodeSourceLocation();
50+
final String urlStr = url == null ? "" : url.toString();
5051
if (urlStr.startsWith("file:/") && (urlStr.endsWith(esPrefix + ".jar") || urlStr.endsWith(esPrefix + "-SNAPSHOT.jar"))) {
5152
try (JarInputStream jar = new JarInputStream(FileSystemUtils.openFileURLStream(url))) {
5253
Manifest manifest = jar.getManifest();
@@ -88,10 +89,13 @@ public class Build {
8889
private final boolean isSnapshot;
8990

9091
/**
91-
* Returns path to elasticsearch codebase path
92+
* The location of the code source for Elasticsearch
93+
*
94+
* @return the location of the code source for Elasticsearch which may be null
9295
*/
93-
static URL getElasticsearchCodebase() {
94-
return Build.class.getProtectionDomain().getCodeSource().getLocation();
96+
static URL getElasticsearchCodeSourceLocation() {
97+
final CodeSource codeSource = Build.class.getProtectionDomain().getCodeSource();
98+
return codeSource == null ? null : codeSource.getLocation();
9599
}
96100

97101
private final String shortHash;

0 commit comments

Comments
 (0)