Skip to content

Commit 3f6434c

Browse files
committed
Merge branch 'master' into ccr
* master: Reduce CLI scripts to one-liners (#30759) SQL: Preserve scoring in bool queries (#30730) QA: Switch rolling upgrade to 3 nodes (#30728) [TEST] Enable DEBUG logging on testAutoQueueSizingWithMax [ML] Don't install empty ML metadata on startup (#30751) Add assertion on removing copy_settings (#30748) bump lucene version for 6_3_0 [DOCS] Mark painless execute api as experimental (#30710) disable annotation processor for docs (#30610) Add more script contexts (#30721) Fix default shards count in create index docs (#30747) Mute testCorruptFileThenSnapshotAndRestore
2 parents 3245e78 + 3ce2297 commit 3f6434c

File tree

74 files changed

+530
-694
lines changed

Some content is hidden

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

74 files changed

+530
-694
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.elasticsearch.gradle.BuildPlugin
2424
import org.gradle.api.Plugin
2525
import org.gradle.api.Project
2626
import org.gradle.api.plugins.JavaBasePlugin
27+
import org.gradle.api.tasks.compile.JavaCompile
2728

2829
/**
2930
* Configures the build to compile against Elasticsearch's test framework and
@@ -49,5 +50,12 @@ public class StandaloneTestPlugin implements Plugin<Project> {
4950
test.testClassesDir project.sourceSets.test.output.classesDir
5051
test.mustRunAfter(project.precommit)
5152
project.check.dependsOn(test)
53+
54+
project.tasks.withType(JavaCompile) {
55+
// This will be the default in Gradle 5.0
56+
if (options.compilerArgs.contains("-processor") == false) {
57+
options.compilerArgs << '-proc:none'
58+
}
59+
}
5260
}
5361
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e -o pipefail
4+
5+
source "`dirname "$0"`"/elasticsearch-env
6+
7+
IFS=';' read -r -a additional_sources <<< "$ES_ADDITIONAL_SOURCES"
8+
for additional_source in "${additional_sources[@]}"
9+
do
10+
source "`dirname "$0"`"/$additional_source
11+
done
12+
13+
exec \
14+
"$JAVA" \
15+
$ES_JAVA_OPTS \
16+
-Des.path.home="$ES_HOME" \
17+
-Des.path.conf="$ES_PATH_CONF" \
18+
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
19+
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
20+
-cp "$ES_CLASSPATH" \
21+
$1 \
22+
"${@:2}"
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
#!/bin/bash
22

3-
source "`dirname "$0"`"/elasticsearch-env
4-
5-
exec \
6-
"$JAVA" \
7-
$ES_JAVA_OPTS \
8-
-Des.path.home="$ES_HOME" \
9-
-Des.path.conf="$ES_PATH_CONF" \
10-
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
11-
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
12-
-cp "$ES_CLASSPATH" \
3+
"`dirname "$0"`"/elasticsearch-cli \
134
org.elasticsearch.common.settings.KeyStoreCli \
145
"$@"
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
#!/bin/bash
22

3-
source "`dirname "$0"`"/elasticsearch-env
4-
5-
exec \
6-
"$JAVA" \
7-
$ES_JAVA_OPTS \
8-
-Des.path.home="$ES_HOME" \
9-
-Des.path.conf="$ES_PATH_CONF" \
10-
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
11-
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
12-
-cp "$ES_CLASSPATH" \
3+
"`dirname "$0"`"/elasticsearch-cli \
134
org.elasticsearch.plugins.PluginCli \
145
"$@"
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
#!/bin/bash
22

3-
source "`dirname "$0"`"/elasticsearch-env
4-
5-
exec \
6-
"$JAVA" \
7-
$ES_JAVA_OPTS \
8-
-Des.path.home="$ES_HOME" \
9-
-Des.path.conf="$ES_PATH_CONF" \
10-
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
11-
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
12-
-cp "$ES_CLASSPATH" \
3+
"`dirname "$0"`"/elasticsearch-cli \
134
org.elasticsearch.index.translog.TranslogToolCli \
145
"$@"

docs/painless/painless-execute-script.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[[painless-execute-api]]
22
=== Painless execute API
33

4+
experimental[The painless execute api is new and the request / response format may change in a breaking way in the future]
5+
46
The Painless execute API allows an arbitrary script to be executed and a result to be returned.
57

68
[[painless-execute-api-parameters]]

docs/reference/indices/create-index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PUT twitter
2525
}
2626
--------------------------------------------------
2727
// CONSOLE
28-
<1> Default for `number_of_shards` is 5
28+
<1> Default for `number_of_shards` is 1
2929
<2> Default for `number_of_replicas` is 1 (ie one replica for each primary shard)
3030

3131
The above second curl example shows how an index called `twitter` can be

plugins/examples/script-expert-scoring/src/main/java/org/elasticsearch/example/expertscript/ExpertScriptPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public String getType() {
5454

5555
@Override
5656
public <T> T compile(String scriptName, String scriptSource, ScriptContext<T> context, Map<String, String> params) {
57-
if (context.equals(SearchScript.CONTEXT) == false) {
57+
if (context.equals(SearchScript.SCRIPT_SCORE_CONTEXT) == false) {
5858
throw new IllegalArgumentException(getType() + " scripts cannot be used for context [" + context.name + "]");
5959
}
6060
// we use the script "source" as the script identifier

qa/rolling-upgrade/build.gradle

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ task bwcTest {
3030
}
3131

3232
for (Version version : bwcVersions.wireCompatible) {
33+
/*
34+
* The goal here is to:
35+
* <ul>
36+
* <li>start three nodes on the old version
37+
* <li>run tests with systemProperty 'tests.rest.suite', 'old_cluster'
38+
* <li>shut down one node
39+
* <li>start a node with the new version
40+
* <li>run tests with systemProperty 'tests.rest.suite', 'mixed_cluster'
41+
* <li>shut down one node on the old version
42+
* <li>start a node with the new version
43+
* <li>run tests with systemProperty 'tests.rest.suite', 'mixed_cluster' again
44+
* <li>shut down the last node with the old version
45+
* <li>start a node with the new version
46+
* <li>run tests with systemProperty 'tests.rest.suite', 'upgraded_cluster'
47+
* <li>shut down the entire cluster
48+
* </ul>
49+
*
50+
* Be careful: gradle dry run spits out tasks in the wrong order but,
51+
* strangely, running the tasks works properly.
52+
*/
3353
String baseName = "v${version}"
3454

3555
Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) {
@@ -39,8 +59,8 @@ for (Version version : bwcVersions.wireCompatible) {
3959
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
4060
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
4161
bwcVersion = version
42-
numBwcNodes = 2
43-
numNodes = 2
62+
numBwcNodes = 3
63+
numNodes = 3
4464
clusterName = 'rolling-upgrade'
4565
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
4666
if (version.onOrAfter('5.3.0')) {
@@ -53,43 +73,57 @@ for (Version version : bwcVersions.wireCompatible) {
5373
systemProperty 'tests.rest.suite', 'old_cluster'
5474
}
5575

56-
Task mixedClusterTest = tasks.create(name: "${baseName}#mixedClusterTest", type: RestIntegTestTask)
76+
Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure unicastSeed ->
77+
configure(extensions.findByName("${baseName}#${name}")) {
78+
dependsOn lastRunner, "${baseName}#oldClusterTestCluster#node${stopNode}.stop"
79+
clusterName = 'rolling-upgrade'
80+
unicastTransportUri = { seedNode, node, ant -> unicastSeed() }
81+
minimumMasterNodes = { 3 }
82+
/* Override the data directory so the new node always gets the node we
83+
* just stopped's data directory. */
84+
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
85+
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
86+
}
87+
}
5788

58-
configure(extensions.findByName("${baseName}#mixedClusterTestCluster")) {
59-
dependsOn oldClusterTestRunner, "${baseName}#oldClusterTestCluster#node1.stop"
60-
clusterName = 'rolling-upgrade'
61-
unicastTransportUri = { seedNode, node, ant -> oldClusterTest.nodes.get(0).transportUri() }
62-
minimumMasterNodes = { 2 }
63-
/* Override the data directory so the new node always gets the node we
64-
* just stopped's data directory. */
65-
dataDir = { nodeNumber -> oldClusterTest.nodes[1].dataDir }
66-
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
89+
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
90+
91+
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner,
92+
0, { oldClusterTest.nodes.get(1).transportUri() })
93+
94+
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
95+
oneThirdUpgradedTestRunner.configure {
96+
systemProperty 'tests.rest.suite', 'mixed_cluster'
97+
systemProperty 'tests.first_round', 'true'
98+
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
6799
}
68100

69-
Task mixedClusterTestRunner = tasks.getByName("${baseName}#mixedClusterTestRunner")
70-
mixedClusterTestRunner.configure {
101+
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
102+
103+
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner,
104+
1, { oneThirdUpgradedTest.nodes.get(0).transportUri() })
105+
106+
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
107+
twoThirdsUpgradedTestRunner.configure {
71108
systemProperty 'tests.rest.suite', 'mixed_cluster'
72-
finalizedBy "${baseName}#oldClusterTestCluster#node0.stop"
109+
systemProperty 'tests.first_round', 'false'
110+
finalizedBy "${baseName}#oldClusterTestCluster#node2.stop"
73111
}
74112

75113
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
76114

77-
configure(extensions.findByName("${baseName}#upgradedClusterTestCluster")) {
78-
dependsOn mixedClusterTestRunner, "${baseName}#oldClusterTestCluster#node0.stop"
79-
clusterName = 'rolling-upgrade'
80-
unicastTransportUri = { seedNode, node, ant -> mixedClusterTest.nodes.get(0).transportUri() }
81-
minimumMasterNodes = { 2 }
82-
/* Override the data directory so the new node always gets the node we
83-
* just stopped's data directory. */
84-
dataDir = { nodeNumber -> oldClusterTest.nodes[0].dataDir}
85-
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
86-
}
115+
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner,
116+
2, { twoThirdsUpgradedTest.nodes.get(0).transportUri() })
87117

88118
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
89119
upgradedClusterTestRunner.configure {
90120
systemProperty 'tests.rest.suite', 'upgraded_cluster'
91-
// only need to kill the mixed cluster tests node here because we explicitly told it to not stop nodes upon completion
92-
finalizedBy "${baseName}#mixedClusterTestCluster#stop"
121+
/*
122+
* Force stopping all the upgraded nodes after the test runner
123+
* so they are alive during the test.
124+
*/
125+
finalizedBy "${baseName}#oneThirdUpgradedTestCluster#stop"
126+
finalizedBy "${baseName}#twoThirdsUpgradedTestCluster#stop"
93127
}
94128

95129
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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.upgrades;
20+
21+
import org.apache.http.entity.ContentType;
22+
import org.apache.http.entity.StringEntity;
23+
import org.elasticsearch.Version;
24+
import org.elasticsearch.action.support.PlainActionFuture;
25+
import org.elasticsearch.client.Response;
26+
import org.elasticsearch.cluster.metadata.IndexMetaData;
27+
import org.elasticsearch.common.settings.Settings;
28+
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
29+
import org.elasticsearch.test.rest.ESRestTestCase;
30+
import org.elasticsearch.test.rest.yaml.ObjectPath;
31+
32+
import java.io.IOException;
33+
import java.util.ArrayList;
34+
import java.util.Collections;
35+
import java.util.List;
36+
import java.util.Map;
37+
import java.util.concurrent.Future;
38+
import java.util.function.Predicate;
39+
40+
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiOfLength;
41+
import static java.util.Collections.emptyMap;
42+
import static org.elasticsearch.cluster.routing.UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING;
43+
import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE_SETTING;
44+
import static org.elasticsearch.cluster.routing.allocation.decider.MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY;
45+
import static org.hamcrest.Matchers.equalTo;
46+
import static org.hamcrest.Matchers.hasSize;
47+
import static org.hamcrest.Matchers.notNullValue;
48+
49+
public abstract class AbstractRollingTestCase extends ESRestTestCase {
50+
protected enum ClusterType {
51+
OLD,
52+
MIXED,
53+
UPGRADED;
54+
55+
public static ClusterType parse(String value) {
56+
switch (value) {
57+
case "old_cluster":
58+
return OLD;
59+
case "mixed_cluster":
60+
return MIXED;
61+
case "upgraded_cluster":
62+
return UPGRADED;
63+
default:
64+
throw new AssertionError("unknown cluster type: " + value);
65+
}
66+
}
67+
}
68+
69+
protected static final ClusterType CLUSTER_TYPE = ClusterType.parse(System.getProperty("tests.rest.suite"));
70+
71+
@Override
72+
protected final boolean preserveIndicesUponCompletion() {
73+
return true;
74+
}
75+
76+
@Override
77+
protected final boolean preserveReposUponCompletion() {
78+
return true;
79+
}
80+
81+
@Override
82+
protected final Settings restClientSettings() {
83+
return Settings.builder().put(super.restClientSettings())
84+
// increase the timeout here to 90 seconds to handle long waits for a green
85+
// cluster health. the waits for green need to be longer than a minute to
86+
// account for delayed shards
87+
.put(ESRestTestCase.CLIENT_RETRY_TIMEOUT, "90s")
88+
.put(ESRestTestCase.CLIENT_SOCKET_TIMEOUT, "90s")
89+
.build();
90+
}
91+
}

0 commit comments

Comments
 (0)