Skip to content

Commit fea358b

Browse files
committed
Merge remote-tracking branch 'elastic/master' into execute-actions-under-permit-primary-mode-only
* elastic/master: Move the FIPS configuration back to the build plugin (elastic#41989) Remove stray back tick that's messing up table format (elastic#41705) Add missing comma in code section (elastic#41678) add 7.1.1 and 6.8.1 versions (elastic#42253) Use spearate testkit dir for each run (elastic#42013) Add experimental and warnings to vector functions (elastic#42205) Fix version in tests since elastic#41906 was merged Bump version in BWC check after backport Prevent in-place downgrades and invalid upgrades (elastic#41731) Mute date_histo interval bwc test
2 parents ff90a28 + 1911d2a commit fea358b

File tree

25 files changed

+632
-97
lines changed

25 files changed

+632
-97
lines changed

build.gradle

-15
Original file line numberDiff line numberDiff line change
@@ -619,21 +619,6 @@ allprojects {
619619
}
620620
}
621621

622-
subprojects {
623-
// Common config when running with a FIPS-140 runtime JVM
624-
if (project.ext.has("inFipsJvm") && project.ext.inFipsJvm) {
625-
tasks.withType(Test) {
626-
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
627-
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
628-
}
629-
project.pluginManager.withPlugin("elasticsearch.testclusters") {
630-
project.testClusters.all {
631-
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
632-
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
633-
}
634-
}
635-
}
636-
}
637622

638623

639624

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

+16
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ class BuildPlugin implements Plugin<Project> {
116116
configureTestTasks(project)
117117
configurePrecommit(project)
118118
configureDependenciesInfo(project)
119+
120+
// Common config when running with a FIPS-140 runtime JVM
121+
// Need to do it here to support external plugins
122+
if (project.ext.inFipsJvm) {
123+
project.tasks.withType(Test) {
124+
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
125+
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
126+
}
127+
project.pluginManager.withPlugin("elasticsearch.testclusters") {
128+
project.testClusters.all {
129+
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
130+
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
131+
}
132+
}
133+
}
134+
119135
}
120136

121137

buildSrc/src/test/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTaskIT.java

+12-22
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,35 @@
2121

2222
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
2323
import org.gradle.testkit.runner.BuildResult;
24-
import org.gradle.testkit.runner.GradleRunner;
2524

2625

2726
public class ExportElasticsearchBuildResourcesTaskIT extends GradleIntegrationTestCase {
2827

2928
public static final String PROJECT_NAME = "elasticsearch-build-resources";
3029

3130
public void testUpToDateWithSourcesConfigured() {
32-
GradleRunner.create()
33-
.withProjectDir(getProjectDir(PROJECT_NAME))
31+
getGradleRunner(PROJECT_NAME)
3432
.withArguments("clean", "-s")
35-
.withPluginClasspath()
3633
.build();
3734

38-
BuildResult result = GradleRunner.create()
39-
.withProjectDir(getProjectDir(PROJECT_NAME))
35+
BuildResult result = getGradleRunner(PROJECT_NAME)
4036
.withArguments("buildResources", "-s", "-i")
41-
.withPluginClasspath()
4237
.build();
4338
assertTaskSuccessful(result, ":buildResources");
4439
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle.xml");
4540
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
4641

47-
result = GradleRunner.create()
48-
.withProjectDir(getProjectDir(PROJECT_NAME))
42+
result = getGradleRunner(PROJECT_NAME)
4943
.withArguments("buildResources", "-s", "-i")
50-
.withPluginClasspath()
5144
.build();
5245
assertTaskUpToDate(result, ":buildResources");
5346
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle.xml");
5447
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
5548
}
5649

5750
public void testImplicitTaskDependencyCopy() {
58-
BuildResult result = GradleRunner.create()
59-
.withProjectDir(getProjectDir(PROJECT_NAME))
51+
BuildResult result = getGradleRunner(PROJECT_NAME)
6052
.withArguments("clean", "sampleCopyAll", "-s", "-i")
61-
.withPluginClasspath()
6253
.build();
6354

6455
assertTaskSuccessful(result, ":buildResources");
@@ -69,10 +60,8 @@ public void testImplicitTaskDependencyCopy() {
6960
}
7061

7162
public void testImplicitTaskDependencyInputFileOfOther() {
72-
BuildResult result = GradleRunner.create()
73-
.withProjectDir(getProjectDir(PROJECT_NAME))
63+
BuildResult result = getGradleRunner(PROJECT_NAME)
7464
.withArguments("clean", "sample", "-s", "-i")
75-
.withPluginClasspath()
7665
.build();
7766

7867
assertTaskSuccessful(result, ":sample");
@@ -81,11 +70,12 @@ public void testImplicitTaskDependencyInputFileOfOther() {
8170
}
8271

8372
public void testIncorrectUsage() {
84-
BuildResult result = GradleRunner.create()
85-
.withProjectDir(getProjectDir(PROJECT_NAME))
86-
.withArguments("noConfigAfterExecution", "-s", "-i")
87-
.withPluginClasspath()
88-
.buildAndFail();
89-
assertOutputContains("buildResources can't be configured after the task ran");
73+
assertOutputContains(
74+
getGradleRunner(PROJECT_NAME)
75+
.withArguments("noConfigAfterExecution", "-s", "-i")
76+
.buildAndFail()
77+
.getOutput(),
78+
"buildResources can't be configured after the task ran"
79+
);
9080
}
9181
}

buildSrc/src/test/java/org/elasticsearch/gradle/precommit/JarHellTaskIT.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
44
import org.gradle.testkit.runner.BuildResult;
5-
import org.gradle.testkit.runner.GradleRunner;
65

76
/*
87
* Licensed to Elasticsearch under one or more contributor
@@ -25,10 +24,8 @@
2524
public class JarHellTaskIT extends GradleIntegrationTestCase {
2625

2726
public void testJarHellDetected() {
28-
BuildResult result = GradleRunner.create()
29-
.withProjectDir(getProjectDir("jarHell"))
27+
BuildResult result = getGradleRunner("jarHell")
3028
.withArguments("clean", "precommit", "-s", "-Dlocal.repo.path=" + getLocalTestRepoPath())
31-
.withPluginClasspath()
3229
.buildAndFail();
3330

3431
assertTaskFailed(result, ":jarHell");

buildSrc/src/test/java/org/elasticsearch/gradle/test/GradleIntegrationTestCase.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
import org.gradle.testkit.runner.BuildTask;
55
import org.gradle.testkit.runner.GradleRunner;
66
import org.gradle.testkit.runner.TaskOutcome;
7+
import org.junit.Rule;
8+
import org.junit.rules.TemporaryFolder;
79

810
import java.io.File;
11+
import java.io.IOException;
12+
import java.io.UncheckedIOException;
913
import java.nio.file.Files;
1014
import java.nio.file.Path;
1115
import java.util.List;
@@ -16,6 +20,9 @@
1620

1721
public abstract class GradleIntegrationTestCase extends GradleUnitTestCase {
1822

23+
@Rule
24+
public TemporaryFolder testkitTmpDir = new TemporaryFolder();
25+
1926
protected File getProjectDir(String name) {
2027
File root = new File("src/testKit/");
2128
if (root.exists() == false) {
@@ -26,9 +33,16 @@ protected File getProjectDir(String name) {
2633
}
2734

2835
protected GradleRunner getGradleRunner(String sampleProject) {
36+
File testkit;
37+
try {
38+
testkit = testkitTmpDir.newFolder();
39+
} catch (IOException e) {
40+
throw new UncheckedIOException(e);
41+
}
2942
return GradleRunner.create()
3043
.withProjectDir(getProjectDir(sampleProject))
31-
.withPluginClasspath();
44+
.withPluginClasspath()
45+
.withTestKitDir(testkit);
3246
}
3347

3448
protected File getBuildDir(String name) {

buildSrc/src/test/java/org/elasticsearch/gradle/testclusters/TestClustersPluginIT.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,21 @@
2121
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
2222
import org.gradle.testkit.runner.BuildResult;
2323
import org.gradle.testkit.runner.GradleRunner;
24+
import org.junit.Before;
2425
import org.junit.Ignore;
2526

27+
2628
import java.util.Arrays;
2729

2830
public class TestClustersPluginIT extends GradleIntegrationTestCase {
2931

32+
private GradleRunner runner;
33+
34+
@Before
35+
public void setUp() throws Exception {
36+
runner = getGradleRunner("testclusters");
37+
}
38+
3039
public void testListClusters() {
3140
BuildResult result = getTestClustersRunner("listTestClusters").build();
3241

@@ -190,10 +199,7 @@ private GradleRunner getTestClustersRunner(String... tasks) {
190199
arguments[tasks.length] = "-s";
191200
arguments[tasks.length + 1] = "-i";
192201
arguments[tasks.length + 2] = "-Dlocal.repo.path=" + getLocalTestRepoPath();
193-
return GradleRunner.create()
194-
.withProjectDir(getProjectDir("testclusters"))
195-
.withArguments(arguments)
196-
.withPluginClasspath();
202+
return runner.withArguments(arguments);
197203
}
198204

199205
private void assertStartedAndStoppedOnce(BuildResult result, String nodeName) {

docs/reference/cat/thread_pool.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ml_autodetect (default distro only)
5959
ml_datafeed (default distro only)
6060
ml_utility (default distro only)
6161
refresh
62-
rollup_indexing (default distro only)`
62+
rollup_indexing (default distro only)
6363
search
6464
security-token-key (default distro only)
6565
snapshot

docs/reference/commands/node-tool.asciidoc

+60-3
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44
The `elasticsearch-node` command enables you to perform certain unsafe
55
operations on a node that are only possible while it is shut down. This command
66
allows you to adjust the <<modules-node,role>> of a node and may be able to
7-
recover some data after a disaster.
7+
recover some data after a disaster or start a node even if it is incompatible
8+
with the data on disk.
89

910
[float]
1011
=== Synopsis
1112

1213
[source,shell]
1314
--------------------------------------------------
14-
bin/elasticsearch-node repurpose|unsafe-bootstrap|detach-cluster
15+
bin/elasticsearch-node repurpose|unsafe-bootstrap|detach-cluster|override-version
1516
[--ordinal <Integer>] [-E <KeyValuePair>]
1617
[-h, --help] ([-s, --silent] | [-v, --verbose])
1718
--------------------------------------------------
1819

1920
[float]
2021
=== Description
2122

22-
This tool has three modes:
23+
This tool has four modes:
2324

2425
* `elasticsearch-node repurpose` can be used to delete unwanted data from a
2526
node if it used to be a <<data-node,data node>> or a
@@ -36,6 +37,11 @@ This tool has three modes:
3637
cluster bootstrapping was not possible, it also enables you to move nodes
3738
into a brand-new cluster.
3839

40+
* `elasticsearch-node override-version` enables you to start up a node
41+
even if the data in the data path was written by an incompatible version of
42+
{es}. This may sometimes allow you to downgrade to an earlier version of
43+
{es}.
44+
3945
[[node-tool-repurpose]]
4046
[float]
4147
==== Changing the role of a node
@@ -109,6 +115,25 @@ way forward that does not risk data loss, but it may be possible to use the
109115
`elasticsearch-node` tool to construct a new cluster that contains some of the
110116
data from the failed cluster.
111117

118+
[[node-tool-override-version]]
119+
[float]
120+
==== Bypassing version checks
121+
122+
The data that {es} writes to disk is designed to be read by the current version
123+
and a limited set of future versions. It cannot generally be read by older
124+
versions, nor by versions that are more than one major version newer. The data
125+
stored on disk includes the version of the node that wrote it, and {es} checks
126+
that it is compatible with this version when starting up.
127+
128+
In rare circumstances it may be desirable to bypass this check and start up an
129+
{es} node using data that was written by an incompatible version. This may not
130+
work if the format of the stored data has changed, and it is a risky process
131+
because it is possible for the format to change in ways that {es} may
132+
misinterpret, silently leading to data loss.
133+
134+
To bypass this check, you can use the `elasticsearch-node override-version`
135+
tool to overwrite the version number stored in the data path with the current
136+
version, causing {es} to believe that it is compatible with the on-disk data.
112137

113138
[[node-tool-unsafe-bootstrap]]
114139
[float]
@@ -262,6 +287,9 @@ one-node cluster.
262287
`detach-cluster`:: Specifies to unsafely detach this node from its cluster so
263288
it can join a different cluster.
264289

290+
`override-version`:: Overwrites the version number stored in the data path so
291+
that a node can start despite being incompatible with the on-disk data.
292+
265293
`--ordinal <Integer>`:: If there is <<max-local-storage-nodes,more than one
266294
node sharing a data path>> then this specifies which node to target. Defaults
267295
to `0`, meaning to use the first node in the data path.
@@ -423,3 +451,32 @@ Do you want to proceed?
423451
Confirm [y/N] y
424452
Node was successfully detached from the cluster
425453
----
454+
455+
[float]
456+
==== Bypassing version checks
457+
458+
Run the `elasticsearch-node override-version` command to overwrite the version
459+
stored in the data path so that a node can start despite being incompatible
460+
with the data stored in the data path:
461+
462+
[source, txt]
463+
----
464+
node$ ./bin/elasticsearch-node override-version
465+
466+
WARNING: Elasticsearch MUST be stopped before running this tool.
467+
468+
This data path was last written by Elasticsearch version [x.x.x] and may no
469+
longer be compatible with Elasticsearch version [y.y.y]. This tool will bypass
470+
this compatibility check, allowing a version [y.y.y] node to start on this data
471+
path, but a version [y.y.y] node may not be able to read this data or may read
472+
it incorrectly leading to data loss.
473+
474+
You should not use this tool. Instead, continue to use a version [x.x.x] node
475+
on this data path. If necessary, you can use reindex-from-remote to copy the
476+
data from here into an older cluster.
477+
478+
Do you want to proceed?
479+
480+
Confirm [y/N] y
481+
Successfully overwrote this node's metadata to bypass its version compatibility checks.
482+
----

docs/reference/query-dsl/script-score-query.asciidoc

+8
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,18 @@ to be the most efficient by using the internal mechanisms.
7878

7979
[[vector-functions]]
8080
===== Functions for vector fields
81+
82+
experimental[]
83+
8184
These functions are used for
8285
for <<dense-vector,`dense_vector`>> and
8386
<<sparse-vector,`sparse_vector`>> fields.
8487

88+
NOTE: During vector functions' calculation, all matched documents are
89+
linearly scanned. Thus, expect the query time grow linearly
90+
with the number of matched documents. For this reason, we recommend
91+
to limit the number of matched documents with a `query` parameter.
92+
8593
For dense_vector fields, `cosineSimilarity` calculates the measure of
8694
cosine similarity between a given query vector and document vectors.
8795

docs/reference/search/rank-eval.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ GET /my_index/_rank_eval
111111
],
112112
"requests": [
113113
{
114-
"id": "amsterdam_query"
114+
"id": "amsterdam_query",
115115
"ratings": [ ... ],
116116
"template_id": "match_one_field_query", <3>
117117
"params": { <4>

0 commit comments

Comments
 (0)