Skip to content

Commit ad7229f

Browse files
committed
Merge branch 'master' into feature/seq_no
* master: (158 commits) Document the hack Refactor property placeholder use of env. vars Force java9 log4j hack in testing Fix log4j buggy java version detection Make java9 work again Don't mkdir directly in deb init script Fix env. var placeholder test so it's reproducible Remove ScriptMode class in favor of boolean true/false [rest api spec] fix doc urls Netty request/response tracer should wait for send Filter client/server VM options from jvm.options [rest api spec] fix url for reindex api docs Remove use of a Fields class in snapshot responses that contains x-content keys, in favor of declaring/using the keys directly. Limit retries of failed allocations per index (#18467) Proxy box method to use valueOf. Use the build-in valueOf method instead of the custom one. Fixed tests and added a comment to the box method. Fix boxing. Do not decode path when sending error Fix race condition in snapshot initialization ...
2 parents f6694be + cec4b9a commit ad7229f

File tree

825 files changed

+25923
-15550
lines changed

Some content is hidden

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

825 files changed

+25923
-15550
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ Once your changes and tests are ready to submit for review:
7171

7272
Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into Elasticsearch.
7373

74+
Please adhere to the general guideline that you should never force push
75+
to a publicly shared branch. Once you have opened your pull request, you
76+
should consider your branch publicly shared. Instead of force pushing
77+
you can just add incremental commits; this is generally easier on your
78+
reviewers. If you need to pick up changes from master, you can merge
79+
master into your branch. A reviewer might ask you to rebase a
80+
long-running pull request in which case force pushing is okay for that
81+
request. Note that squashing at the end of the review process should
82+
also not be done, that can be done when the pull request is [integrated
83+
via GitHub](https://github.com/blog/2141-squash-your-commits).
84+
7485
Contributing to the Elasticsearch codebase
7586
------------------------------------------
7687

TESTING.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ gradle test -Dtests.timeoutSuite=5000! ...
201201
Change the logging level of ES (not gradle)
202202

203203
--------------------------------
204-
gradle test -Des.logger.level=DEBUG
204+
gradle test -Dtests.logger.level=DEBUG
205205
--------------------------------
206206

207207
Print all the logging output from the test runs to the commandline

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ class BuildPlugin implements Plugin<Project> {
378378
* -serial because we don't use java serialization.
379379
*/
380380
// don't even think about passing args with -J-xxx, oracle will ask you to submit a bug report :)
381-
options.compilerArgs << '-Werror' << '-Xlint:all,-path,-serial' << '-Xdoclint:all' << '-Xdoclint:-missing'
381+
options.compilerArgs << '-Werror' << '-Xlint:all,-path,-serial,-options' << '-Xdoclint:all' << '-Xdoclint:-missing'
382382
// compile with compact 3 profile by default
383383
// NOTE: this is just a compile time check: does not replace testing with a compact3 JRE
384384
if (project.compactProfile != 'full') {
@@ -456,7 +456,7 @@ class BuildPlugin implements Plugin<Project> {
456456
// default test sysprop values
457457
systemProperty 'tests.ifNoTests', 'fail'
458458
// TODO: remove setting logging level via system property
459-
systemProperty 'es.logger.level', 'WARN'
459+
systemProperty 'tests.logger.level', 'WARN'
460460
for (Map.Entry<String, String> property : System.properties.entrySet()) {
461461
if (property.getKey().startsWith('tests.') ||
462462
property.getKey().startsWith('es.')) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
144144
if (query != null) {
145145
for (String param: query.tokenize('&')) {
146146
def (String name, String value) = param.tokenize('=')
147+
if (value == null) {
148+
value = ''
149+
}
147150
current.println(" $name: \"$value\"")
148151
}
149152
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ class NodeInfo {
129129
}
130130

131131
env = [ 'JAVA_HOME' : project.javaHome ]
132-
args.addAll("-E", "es.node.portsfile=true")
132+
args.addAll("-E", "node.portsfile=true")
133+
String loggerLevel = System.getProperty("tests.logger.level")
134+
if (loggerLevel != null) {
135+
args.addAll("-E", "logger.level=${loggerLevel}")
136+
}
133137
String collectedSystemProperties = config.systemProperties.collect { key, value -> "-D${key}=${value}" }.join(" ")
134138
String esJavaOpts = config.jvmArgs.isEmpty() ? collectedSystemProperties : collectedSystemProperties + " " + config.jvmArgs
135139
env.put('ES_JAVA_OPTS', esJavaOpts)
@@ -140,7 +144,7 @@ class NodeInfo {
140144
}
141145
}
142146
env.put('ES_JVM_OPTIONS', new File(confDir, 'jvm.options'))
143-
args.addAll("-E", "es.path.conf=${confDir}")
147+
args.addAll("-E", "path.conf=${confDir}")
144148
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
145149
args.add('"') // end the entire command, quoted
146150
}

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@
517517
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]ingest[/\\]processor[/\\]ConvertProcessor.java" checks="LineLength" />
518518
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]GcNames.java" checks="LineLength" />
519519
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]HotThreads.java" checks="LineLength" />
520-
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]JvmGcMonitorService.java" checks="LineLength" />
521520
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]JvmStats.java" checks="LineLength" />
522521
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]Node.java" checks="LineLength" />
523522
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]internal[/\\]InternalSettingsPreparer.java" checks="LineLength" />
@@ -1336,7 +1335,6 @@
13361335
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]junit[/\\]listeners[/\\]LoggingListener.java" checks="LineLength" />
13371336
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]ESRestTestCase.java" checks="LineLength" />
13381337
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]RestTestExecutionContext.java" checks="LineLength" />
1339-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]client[/\\]RestClient.java" checks="LineLength" />
13401338
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]client[/\\]http[/\\]HttpRequestBuilder.java" checks="LineLength" />
13411339
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]json[/\\]JsonPath.java" checks="LineLength" />
13421340
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]rest[/\\]parser[/\\]GreaterThanEqualToParser.java" checks="LineLength" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/sh -e
1+
#!/bin/bash -e
22
<% commands.each {command -> %><%= command %><% } %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/sh -e
1+
#!/bin/bash -e
22
<% commands.each {command -> %><%= command %><% } %>

buildSrc/version.properties

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jna = 4.1.0
1313
# test dependencies
1414
randomizedrunner = 2.3.2
1515
junit = 4.11
16-
# TODO: Upgrade httpclient to a version > 4.5.1 once released. Then remove o.e.test.rest.client.StrictHostnameVerifier* and use
17-
# DefaultHostnameVerifier instead since we no longer need to workaround https://issues.apache.org/jira/browse/HTTPCLIENT-1698
18-
httpclient = 4.3.6
19-
httpcore = 4.3.3
16+
httpclient = 4.5.2
17+
httpcore = 4.4.4
2018
commonslogging = 1.1.3
2119
commonscodec = 1.10
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
package org.apache.log4j;
21+
22+
import org.apache.log4j.helpers.ThreadLocalMap;
23+
24+
/**
25+
* Log4j 1.2 MDC breaks because it parses java.version incorrectly (does not handle new java9 versioning).
26+
*
27+
* This hack fixes up the pkg private members as if it had detected the java version correctly.
28+
*/
29+
public class Java9Hack {
30+
31+
public static void fixLog4j() {
32+
if (MDC.mdc.tlm == null) {
33+
MDC.mdc.java1 = false;
34+
MDC.mdc.tlm = new ThreadLocalMap();
35+
}
36+
}
37+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class Version {
6969
public static final Version V_2_3_1 = new Version(V_2_3_1_ID, org.apache.lucene.util.Version.LUCENE_5_5_0);
7070
public static final int V_2_3_2_ID = 2030299;
7171
public static final Version V_2_3_2 = new Version(V_2_3_2_ID, org.apache.lucene.util.Version.LUCENE_5_5_0);
72+
public static final int V_2_3_3_ID = 2030399;
73+
public static final Version V_2_3_3 = new Version(V_2_3_3_ID, org.apache.lucene.util.Version.LUCENE_5_5_0);
7274
public static final int V_5_0_0_alpha1_ID = 5000001;
7375
public static final Version V_5_0_0_alpha1 = new Version(V_5_0_0_alpha1_ID, org.apache.lucene.util.Version.LUCENE_6_0_0);
7476
public static final int V_5_0_0_alpha2_ID = 5000002;
@@ -94,6 +96,8 @@ public static Version fromId(int id) {
9496
return V_5_0_0_alpha2;
9597
case V_5_0_0_alpha1_ID:
9698
return V_5_0_0_alpha1;
99+
case V_2_3_3_ID:
100+
return V_2_3_3;
97101
case V_2_3_2_ID:
98102
return V_2_3_2;
99103
case V_2_3_1_ID:

core/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.action.admin.cluster.allocation;
2121

22-
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
2322
import org.apache.lucene.index.CorruptIndexException;
2423
import org.elasticsearch.ElasticsearchException;
2524
import org.elasticsearch.ExceptionsHelper;
@@ -30,24 +29,19 @@
3029
import org.elasticsearch.action.support.ActionFilters;
3130
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
3231
import org.elasticsearch.cluster.ClusterInfoService;
33-
import org.elasticsearch.cluster.ClusterName;
3432
import org.elasticsearch.cluster.ClusterState;
3533
import org.elasticsearch.cluster.block.ClusterBlockException;
3634
import org.elasticsearch.cluster.block.ClusterBlockLevel;
3735
import org.elasticsearch.cluster.metadata.IndexMetaData;
3836
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
3937
import org.elasticsearch.cluster.metadata.MetaData;
40-
import org.elasticsearch.cluster.metadata.MetaData.Custom;
4138
import org.elasticsearch.cluster.node.DiscoveryNode;
4239
import org.elasticsearch.cluster.routing.RoutingNode;
4340
import org.elasticsearch.cluster.routing.RoutingNodes;
4441
import org.elasticsearch.cluster.routing.RoutingNodes.RoutingNodesIterator;
45-
import org.elasticsearch.cluster.routing.RoutingTable;
4642
import org.elasticsearch.cluster.routing.ShardRouting;
4743
import org.elasticsearch.cluster.routing.UnassignedInfo;
48-
import org.elasticsearch.cluster.routing.allocation.AllocationService;
4944
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
50-
import org.elasticsearch.cluster.routing.allocation.RoutingExplanations;
5145
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator;
5246
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
5347
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
@@ -60,7 +54,6 @@
6054
import org.elasticsearch.transport.TransportService;
6155

6256
import java.util.HashMap;
63-
import java.util.Iterator;
6457
import java.util.List;
6558
import java.util.Map;
6659
import java.util.Set;
@@ -72,7 +65,6 @@
7265
public class TransportClusterAllocationExplainAction
7366
extends TransportMasterNodeAction<ClusterAllocationExplainRequest, ClusterAllocationExplainResponse> {
7467

75-
private final AllocationService allocationService;
7668
private final ClusterInfoService clusterInfoService;
7769
private final AllocationDeciders allocationDeciders;
7870
private final ShardsAllocator shardAllocator;
@@ -82,12 +74,10 @@ public class TransportClusterAllocationExplainAction
8274
public TransportClusterAllocationExplainAction(Settings settings, TransportService transportService, ClusterService clusterService,
8375
ThreadPool threadPool, ActionFilters actionFilters,
8476
IndexNameExpressionResolver indexNameExpressionResolver,
85-
AllocationService allocationService, ClusterInfoService clusterInfoService,
86-
AllocationDeciders allocationDeciders, ShardsAllocator shardAllocator,
87-
TransportIndicesShardStoresAction shardStoresAction) {
77+
ClusterInfoService clusterInfoService, AllocationDeciders allocationDeciders,
78+
ShardsAllocator shardAllocator, TransportIndicesShardStoresAction shardStoresAction) {
8879
super(settings, ClusterAllocationExplainAction.NAME, transportService, clusterService, threadPool, actionFilters,
8980
indexNameExpressionResolver, ClusterAllocationExplainRequest::new);
90-
this.allocationService = allocationService;
9181
this.clusterInfoService = clusterInfoService;
9282
this.allocationDeciders = allocationDeciders;
9383
this.shardAllocator = shardAllocator;
@@ -259,8 +249,8 @@ public static ClusterAllocationExplanation explainShard(ShardRouting shard, Rout
259249
protected void masterOperation(final ClusterAllocationExplainRequest request, final ClusterState state,
260250
final ActionListener<ClusterAllocationExplainResponse> listener) {
261251
final RoutingNodes routingNodes = state.getRoutingNodes();
262-
final RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, routingNodes, state.nodes(),
263-
clusterInfoService.getClusterInfo(), System.nanoTime());
252+
final RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, routingNodes, state,
253+
clusterInfoService.getClusterInfo(), System.nanoTime(), false);
264254

265255
ShardRouting foundShard = null;
266256
if (request.useAnyUnassignedShard()) {

core/src/main/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequest.java

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
* Request to submit cluster reroute allocation commands
3939
*/
4040
public class ClusterRerouteRequest extends AcknowledgedRequest<ClusterRerouteRequest> {
41-
AllocationCommands commands = new AllocationCommands();
42-
boolean dryRun;
43-
boolean explain;
41+
private AllocationCommands commands = new AllocationCommands();
42+
private boolean dryRun;
43+
private boolean explain;
44+
private boolean retryFailed;
4445

4546
public ClusterRerouteRequest() {
4647
}
@@ -81,13 +82,30 @@ public ClusterRerouteRequest explain(boolean explain) {
8182
return this;
8283
}
8384

85+
/**
86+
* Sets the retry failed flag (defaults to <tt>false</tt>). If true, the
87+
* request will retry allocating shards that can't currently be allocated due to too many allocation failures.
88+
*/
89+
public ClusterRerouteRequest setRetryFailed(boolean retryFailed) {
90+
this.retryFailed = retryFailed;
91+
return this;
92+
}
93+
8494
/**
8595
* Returns the current explain flag
8696
*/
8797
public boolean explain() {
8898
return this.explain;
8999
}
90100

101+
/**
102+
* Returns the current retry failed flag
103+
*/
104+
public boolean isRetryFailed() {
105+
return this.retryFailed;
106+
}
107+
108+
91109
/**
92110
* Set the allocation commands to execute.
93111
*/
@@ -96,6 +114,13 @@ public ClusterRerouteRequest commands(AllocationCommand... commands) {
96114
return this;
97115
}
98116

117+
/**
118+
* Returns the allocation commands to execute
119+
*/
120+
public AllocationCommands getCommands() {
121+
return commands;
122+
}
123+
99124
/**
100125
* Sets the source for the request.
101126
*/
@@ -136,6 +161,7 @@ public void readFrom(StreamInput in) throws IOException {
136161
commands = AllocationCommands.readFrom(in);
137162
dryRun = in.readBoolean();
138163
explain = in.readBoolean();
164+
retryFailed = in.readBoolean();
139165
readTimeout(in);
140166
}
141167

@@ -145,6 +171,7 @@ public void writeTo(StreamOutput out) throws IOException {
145171
AllocationCommands.writeTo(commands, out);
146172
out.writeBoolean(dryRun);
147173
out.writeBoolean(explain);
174+
out.writeBoolean(retryFailed);
148175
writeTimeout(out);
149176
}
150177
}

core/src/main/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequestBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public ClusterRerouteRequestBuilder setExplain(boolean explain) {
6060
return this;
6161
}
6262

63+
/**
64+
* Sets the retry failed flag (defaults to <tt>false</tt>). If true, the
65+
* request will retry allocating shards that can't currently be allocated due to too many allocation failures.
66+
*/
67+
public ClusterRerouteRequestBuilder setRetryFailed(boolean retryFailed) {
68+
request.setRetryFailed(retryFailed);
69+
return this;
70+
}
71+
6372
/**
6473
* Sets the commands for the request to execute.
6574
*/

0 commit comments

Comments
 (0)