Skip to content

Commit 03e3bd2

Browse files
committed
Merge branch 'master' into ccr
* master: silence InstallPluginCommandTests, see #30900 Remove left-over comment Fix double semicolon in import statement [TEST] Fix minor random bug from #30794 Include size of snapshot in snapshot metadata #18543, bwc clean up (#30890) Enabling testing against an external cluster (#30885) Add public key header/footer (#30877) SQL: Remove the last remaining server dependencies from jdbc (#30771) Include size of snapshot in snapshot metadata (#29602) Do not serialize basic license exp in x-pack info (#30848) Change BWC version for VerifyRepositoryResponse (#30796) [DOCS] Document index name limitations (#30826) Harmonize include_defaults tests (#30700)
2 parents 345b496 + 6577f5b commit 03e3bd2

File tree

57 files changed

+1075
-962
lines changed

Some content is hidden

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

57 files changed

+1075
-962
lines changed

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

+39-23
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,44 @@ public class RestIntegTestTask extends DefaultTask {
7070
runner.parallelism = '1'
7171
runner.include('**/*IT.class')
7272
runner.systemProperty('tests.rest.load_packaged', 'false')
73-
// we pass all nodes to the rest cluster to allow the clients to round-robin between them
74-
// this is more realistic than just talking to a single node
75-
runner.systemProperty('tests.rest.cluster', "${-> nodes.collect{it.httpUri()}.join(",")}")
76-
runner.systemProperty('tests.config.dir', "${-> nodes[0].pathConf}")
77-
// TODO: our "client" qa tests currently use the rest-test plugin. instead they should have their own plugin
78-
// that sets up the test cluster and passes this transport uri instead of http uri. Until then, we pass
79-
// both as separate sysprops
80-
runner.systemProperty('tests.cluster', "${-> nodes[0].transportUri()}")
81-
82-
// dump errors and warnings from cluster log on failure
83-
TaskExecutionAdapter logDumpListener = new TaskExecutionAdapter() {
84-
@Override
85-
void afterExecute(Task task, TaskState state) {
86-
if (state.failure != null) {
87-
for (NodeInfo nodeInfo : nodes) {
88-
printLogExcerpt(nodeInfo)
73+
74+
if (System.getProperty("tests.rest.cluster") == null) {
75+
if (System.getProperty("tests.cluster") != null) {
76+
throw new IllegalArgumentException("tests.rest.cluster and tests.cluster must both be null or non-null")
77+
}
78+
// we pass all nodes to the rest cluster to allow the clients to round-robin between them
79+
// this is more realistic than just talking to a single node
80+
runner.systemProperty('tests.rest.cluster', "${-> nodes.collect{it.httpUri()}.join(",")}")
81+
runner.systemProperty('tests.config.dir', "${-> nodes[0].pathConf}")
82+
// TODO: our "client" qa tests currently use the rest-test plugin. instead they should have their own plugin
83+
// that sets up the test cluster and passes this transport uri instead of http uri. Until then, we pass
84+
// both as separate sysprops
85+
runner.systemProperty('tests.cluster', "${-> nodes[0].transportUri()}")
86+
87+
// dump errors and warnings from cluster log on failure
88+
TaskExecutionAdapter logDumpListener = new TaskExecutionAdapter() {
89+
@Override
90+
void afterExecute(Task task, TaskState state) {
91+
if (state.failure != null) {
92+
for (NodeInfo nodeInfo : nodes) {
93+
printLogExcerpt(nodeInfo)
94+
}
8995
}
9096
}
9197
}
92-
}
93-
runner.doFirst {
94-
project.gradle.addListener(logDumpListener)
95-
}
96-
runner.doLast {
97-
project.gradle.removeListener(logDumpListener)
98+
runner.doFirst {
99+
project.gradle.addListener(logDumpListener)
100+
}
101+
runner.doLast {
102+
project.gradle.removeListener(logDumpListener)
103+
}
104+
} else {
105+
if (System.getProperty("tests.cluster") == null) {
106+
throw new IllegalArgumentException("tests.rest.cluster and tests.cluster must both be null or non-null")
107+
}
108+
// an external cluster was specified and all responsibility for cluster configuration is taken by the user
109+
runner.systemProperty('tests.rest.cluster', System.getProperty("tests.rest.cluster"))
110+
runner.systemProperty('test.cluster', System.getProperty("tests.cluster"))
98111
}
99112

100113
// copy the rest spec/tests into the test resources
@@ -109,7 +122,10 @@ public class RestIntegTestTask extends DefaultTask {
109122
clusterInit.enabled = false
110123
return // no need to add cluster formation tasks if the task won't run!
111124
}
112-
nodes = ClusterFormationTasks.setup(project, "${name}Cluster", runner, clusterConfig)
125+
// only create the cluster if needed as otherwise an external cluster to use was specified
126+
if (System.getProperty("tests.rest.cluster") == null) {
127+
nodes = ClusterFormationTasks.setup(project, "${name}Cluster", runner, clusterConfig)
128+
}
113129
super.dependsOn(runner.finalizedBy)
114130
}
115131
}

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

+17-5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.env.Environment;
4848

4949
import java.io.BufferedReader;
50+
import java.io.ByteArrayInputStream;
5051
import java.io.IOException;
5152
import java.io.InputStream;
5253
import java.io.InputStreamReader;
@@ -71,7 +72,6 @@
7172
import java.nio.file.attribute.PosixFilePermissions;
7273
import java.security.MessageDigest;
7374
import java.security.NoSuchAlgorithmException;
74-
import java.security.Security;
7575
import java.util.ArrayList;
7676
import java.util.Arrays;
7777
import java.util.Base64;
@@ -543,8 +543,8 @@ void verifySignature(final Path zip, final String urlString) throws IOException,
543543
InputStream fin = pluginZipInputStream(zip);
544544
// sin is a URL stream to the signature corresponding to the downloaded plugin zip
545545
InputStream sin = urlOpenStream(ascUrl);
546-
// pin is a decoded base64 stream over the embedded public key in RFC2045 format
547-
InputStream pin = Base64.getMimeDecoder().wrap(getPublicKey())) {
546+
// pin is a input stream to the public key in ASCII-Armor format (RFC4880); the Armor data is in RFC2045 format
547+
InputStream pin = getPublicKey()) {
548548
final JcaPGPObjectFactory factory = new JcaPGPObjectFactory(PGPUtil.getDecoderStream(sin));
549549
final PGPSignature signature = ((PGPSignatureList) factory.nextObject()).get(0);
550550

@@ -555,7 +555,19 @@ void verifySignature(final Path zip, final String urlString) throws IOException,
555555
}
556556

557557
// compute the signature of the downloaded plugin zip
558-
final PGPPublicKeyRingCollection collection = new PGPPublicKeyRingCollection(pin, new JcaKeyFingerprintCalculator());
558+
final List<String> lines =
559+
new BufferedReader(new InputStreamReader(pin, StandardCharsets.UTF_8)).lines().collect(Collectors.toList());
560+
// skip armor headers and possible blank line
561+
int index = 1;
562+
for (; index < lines.size(); index++) {
563+
if (lines.get(index).matches(".*: .*") == false && lines.get(index).matches("\\s*") == false) {
564+
break;
565+
}
566+
}
567+
final byte[] armoredData =
568+
lines.subList(index, lines.size() - 1).stream().collect(Collectors.joining("\n")).getBytes(StandardCharsets.UTF_8);
569+
final InputStream ain = Base64.getMimeDecoder().wrap(new ByteArrayInputStream(armoredData));
570+
final PGPPublicKeyRingCollection collection = new PGPPublicKeyRingCollection(ain, new JcaKeyFingerprintCalculator());
559571
final PGPPublicKey key = collection.getPublicKey(signature.getKeyID());
560572
signature.init(new JcaPGPContentVerifierBuilderProvider().setProvider(new BouncyCastleProvider()), key);
561573
final byte[] buffer = new byte[1024];
@@ -597,7 +609,7 @@ String getPublicKeyId() {
597609
* @return an input stream to the public key
598610
*/
599611
InputStream getPublicKey() {
600-
return InstallPluginCommand.class.getResourceAsStream("/public_key");
612+
return InstallPluginCommand.class.getResourceAsStream("/public_key.asc");
601613
}
602614

603615
/**

distribution/tools/plugin-cli/src/main/resources/public_key renamed to distribution/tools/plugin-cli/src/main/resources/public_key.asc

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
Version: SKS 1.1.6
3+
Comment: Hostname: pgp.mit.edu
4+
15
mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBDA+bGFOwy
26
hbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9CUliQe324qvObU2Q
37
RtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZj3SF1SPO+TB5QrHkrQHBsmX+
@@ -22,3 +26,4 @@ EyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWg
2226
R7U2r+a210W6vnUxU4oN0PmMcursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNt
2327
fllxIu9XYmiBERQ/qPDlGRlOgVTd9xUfHFkzB52c70E=
2428
=92oX
29+
-----END PGP PUBLIC KEY BLOCK-----

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.common.jimfs.Configuration;
2424
import com.google.common.jimfs.Jimfs;
2525
import org.apache.lucene.util.LuceneTestCase;
26+
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
2627
import org.bouncycastle.bcpg.ArmoredOutputStream;
2728
import org.bouncycastle.bcpg.BCPGOutputStream;
2829
import org.bouncycastle.bcpg.HashAlgorithmTags;
@@ -115,6 +116,7 @@
115116
import static org.hamcrest.Matchers.not;
116117

117118
@LuceneTestCase.SuppressFileSystems("*")
119+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30900")
118120
public class InstallPluginCommandTests extends ESTestCase {
119121

120122
private InstallPluginCommand skipJarHellCommand;
@@ -893,12 +895,7 @@ InputStream getPublicKey() {
893895
final ArmoredOutputStream armored = new ArmoredOutputStream(output);
894896
secretKey.getPublicKey().encode(armored);
895897
armored.close();
896-
final String publicKey = new String(output.toByteArray(), "UTF-8");
897-
int start = publicKey.indexOf("\n", 1 + publicKey.indexOf("\n"));
898-
int end = publicKey.lastIndexOf("\n", publicKey.lastIndexOf("\n") - 1);
899-
// strip the header (first two lines) and footer (last line)
900-
final String substring = publicKey.substring(1 + start, end);
901-
return new ByteArrayInputStream(substring.getBytes("UTF-8"));
898+
return new ByteArrayInputStream(output.toByteArray());
902899
} catch (final IOException e) {
903900
throw new AssertionError(e);
904901
}

docs/reference/indices/create-index.asciidoc

+27-23
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
[[indices-create-index]]
22
== Create Index
33

4-
The create index API allows to instantiate an index. Elasticsearch
5-
provides support for multiple indices, including executing operations
6-
across several indices.
4+
The Create Index API is used to manually create an index in Elasticsearch. All documents in Elasticsearch
5+
are stored inside of one index or another.
6+
7+
The most basic command is the following:
8+
9+
[source,js]
10+
--------------------------------------------------
11+
PUT twitter
12+
--------------------------------------------------
13+
// CONSOLE
14+
15+
This create an index named `twitter` with all default setting.
16+
17+
[NOTE]
18+
.Index name limitations
19+
======================================================
20+
There are several limitations to what you can name your index. The complete list of limitations are:
21+
22+
- Lowercase only
23+
- Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character), `,`, `#`
24+
- Indices prior to 7.0 could contain a colon (`:`), but that's been deprecated and won't be supported in 7.0+
25+
- Cannot start with `-`, `_`, `+`
26+
- Cannot be `.` or ``..`
27+
- Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters will count towards the 255 limit faster)
28+
29+
======================================================
730

831
[float]
932
[[create-index-settings]]
1033
=== Index Settings
1134

1235
Each index created can have specific settings
13-
associated with it.
36+
associated with it, defined in the body:
1437

1538
[source,js]
1639
--------------------------------------------------
@@ -28,25 +51,6 @@ PUT twitter
2851
<1> Default for `number_of_shards` is 1
2952
<2> Default for `number_of_replicas` is 1 (ie one replica for each primary shard)
3053

31-
The above second curl example shows how an index called `twitter` can be
32-
created with specific settings for it using http://www.yaml.org[YAML].
33-
In this case, creating an index with 3 shards, each with 2 replicas. The
34-
index settings can also be defined with http://www.json.org[JSON]:
35-
36-
[source,js]
37-
--------------------------------------------------
38-
PUT twitter
39-
{
40-
"settings" : {
41-
"index" : {
42-
"number_of_shards" : 3,
43-
"number_of_replicas" : 2
44-
}
45-
}
46-
}
47-
--------------------------------------------------
48-
// CONSOLE
49-
5054
or more simplified
5155

5256
[source,js]

docs/reference/migration/migrate_7_0.asciidoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Elasticsearch 6.x in order to be readable by Elasticsearch 7.x.
3535
* <<breaking_70_java_changes>>
3636
* <<breaking_70_settings_changes>>
3737
* <<breaking_70_scripting_changes>>
38-
38+
* <<breaking_70_snapshotstats_changes>>
3939

4040
include::migrate_7_0/aggregations.asciidoc[]
4141
include::migrate_7_0/analysis.asciidoc[]
@@ -49,3 +49,4 @@ include::migrate_7_0/api.asciidoc[]
4949
include::migrate_7_0/java.asciidoc[]
5050
include::migrate_7_0/settings.asciidoc[]
5151
include::migrate_7_0/scripting.asciidoc[]
52+
include::migrate_7_0/snapshotstats.asciidoc[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[breaking_70_snapshotstats_changes]]
2+
=== Snapshot stats changes
3+
4+
Snapshot stats details are provided in a new structured way:
5+
6+
* `total` section for all the files that are referenced by the snapshot.
7+
* `incremental` section for those files that actually needed to be copied over as part of the incremental snapshotting.
8+
* In case of a snapshot that's still in progress, there's also a `processed` section for files that are in the process of being copied.
9+
10+
==== Deprecated `number_of_files`, `processed_files`, `total_size_in_bytes` and `processed_size_in_bytes` snapshot stats properties have been removed
11+
12+
* Properties `number_of_files` and `total_size_in_bytes` are removed and should be replaced by values of nested object `total`.
13+
* Properties `processed_files` and `processed_size_in_bytes` are removed and should be replaced by values of nested object `processed`.

docs/reference/modules/snapshots.asciidoc

+48
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,54 @@ GET /_snapshot/my_backup/snapshot_1/_status
563563
// CONSOLE
564564
// TEST[continued]
565565

566+
The output looks similar to the following:
567+
568+
[source,js]
569+
--------------------------------------------------
570+
{
571+
"snapshots": [
572+
{
573+
"snapshot": "snapshot_1",
574+
"repository": "my_backup",
575+
"uuid": "XuBo4l4ISYiVg0nYUen9zg",
576+
"state": "SUCCESS",
577+
"include_global_state": true,
578+
"shards_stats": {
579+
"initializing": 0,
580+
"started": 0,
581+
"finalizing": 0,
582+
"done": 5,
583+
"failed": 0,
584+
"total": 5
585+
},
586+
"stats": {
587+
"incremental": {
588+
"file_count": 8,
589+
"size_in_bytes": 4704
590+
},
591+
"processed": {
592+
"file_count": 7,
593+
"size_in_bytes": 4254
594+
},
595+
"total": {
596+
"file_count": 8,
597+
"size_in_bytes": 4704
598+
},
599+
"start_time_in_millis": 1526280280355,
600+
"time_in_millis": 358
601+
}
602+
}
603+
]
604+
}
605+
--------------------------------------------------
606+
// TESTRESPONSE
607+
608+
The output is composed of different sections. The `stats` sub-object provides details on the number and size of files that were
609+
snapshotted. As snapshots are incremental, copying only the Lucene segments that are not already in the repository,
610+
the `stats` object contains a `total` section for all the files that are referenced by the snapshot, as well as an `incremental` section
611+
for those files that actually needed to be copied over as part of the incremental snapshotting. In case of a snapshot that's still
612+
in progress, there's also a `processed` section that contains information about the files that are in the process of being copied.
613+
566614
Multiple ids are also supported:
567615

568616
[source,sh]

qa/smoke-test-rank-eval-with-mustache/build.gradle

-6
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,3 @@ dependencies {
2525
testCompile project(path: ':modules:rank-eval', configuration: 'runtime')
2626
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
2727
}
28-
29-
/*
30-
* One of the integration tests doesn't work with the zip distribution
31-
* and will be fixed later.
32-
* Tracked by https://github.com/elastic/elasticsearch/issues/30628
33-
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
setup:
3+
- do:
4+
indices.create:
5+
body:
6+
settings:
7+
index:
8+
number_of_shards: 1
9+
number_of_replicas: 1
10+
index: test-index
11+
---
12+
Test retrieval of default settings:
13+
- skip:
14+
version: " - 6.3.99"
15+
reason: include_defaults will not work in mixed-mode clusters containing nodes pre-6.4
16+
- do:
17+
indices.get_settings:
18+
flat_settings: true
19+
index: test-index
20+
- is_false:
21+
test-index.settings.index\.refresh_interval
22+
- do:
23+
indices.get_settings:
24+
include_defaults: true
25+
flat_settings: true
26+
index: test-index
27+
- match:
28+
test-index.defaults.index\.refresh_interval: "1s"

rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_settings/11_reset.yml

-12
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,3 @@ Test reset index settings:
2323
indices.get_settings:
2424
flat_settings: false
2525
- is_false: test-index.settings.index\.refresh_interval
26-
27-
# Disabled until https://github.com/elastic/elasticsearch/pull/29229 is back-ported
28-
# That PR changed the execution path of index settings default to be on the master
29-
# until the PR is back-ported the old master will not return default settings.
30-
#
31-
# - do:
32-
# indices.get_settings:
33-
# include_defaults: true
34-
# flat_settings: true
35-
# index: test-index
36-
# - match:
37-
# test-index.defaults.index\.refresh_interval: "1s"

0 commit comments

Comments
 (0)