Skip to content

Commit 85af782

Browse files
committed
Merge branch 'master' into feature/searchable-snapshots
2 parents e419d91 + cd0857c commit 85af782

File tree

199 files changed

+4050
-2066
lines changed

Some content is hidden

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

199 files changed

+4050
-2066
lines changed

.ci/bwcVersions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ BWC_VERSION:
1414
- "7.5.0"
1515
- "7.5.1"
1616
- "7.5.2"
17+
- "7.5.3"
1718
- "7.6.0"
1819
- "8.0.0"

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ subprojects {
107107
// switched to an exclude list, and eventualy removed completely.
108108
def projectPathsToFormat = [
109109
':build-tools',
110+
':distribution:tools:java-version-checker',
111+
':distribution:tools:keystore-cli',
112+
':distribution:tools:launchers',
113+
':distribution:tools:plugin-cli',
110114
':x-pack:plugin:autoscaling',
111115
':x-pack:plugin:enrich'
112116
]

client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public void testIndexFollowing() throws Exception {
7676
CcrClient ccrClient = highLevelClient().ccr();
7777

7878
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
79-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
8079
CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
8180
assertThat(response.isAcknowledged(), is(true));
8281

@@ -193,7 +192,6 @@ public void testForgetFollower() throws IOException {
193192
final int numberOfShards = randomIntBetween(1, 2);
194193
settings.put("index.number_of_replicas", "0");
195194
settings.put("index.number_of_shards", Integer.toString(numberOfShards));
196-
settings.put("index.soft_deletes.enabled", Boolean.TRUE.toString());
197195
createIndexRequest.settings(settings);
198196
final CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
199197
assertThat(response.isAcknowledged(), is(true));
@@ -252,7 +250,6 @@ public void testAutoFollowing() throws Exception {
252250
assertThat(putAutoFollowPatternResponse.isAcknowledged(), is(true));
253251

254252
CreateIndexRequest createIndexRequest = new CreateIndexRequest("logs-20200101");
255-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
256253
CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
257254
assertThat(response.isAcknowledged(), is(true));
258255

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CCRDocumentationIT.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public void testPutFollow() throws Exception {
8080
{
8181
// Create leader index:
8282
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
83-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
8483
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
8584
assertThat(response.isAcknowledged(), is(true));
8685
}
@@ -161,7 +160,6 @@ public void testPauseFollow() throws Exception {
161160
{
162161
// Create leader index:
163162
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
164-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
165163
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
166164
assertThat(response.isAcknowledged(), is(true));
167165
}
@@ -227,7 +225,6 @@ public void testResumeFollow() throws Exception {
227225
{
228226
// Create leader index:
229227
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
230-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
231228
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
232229
assertThat(response.isAcknowledged(), is(true));
233230
}
@@ -303,7 +300,6 @@ public void testUnfollow() throws Exception {
303300
{
304301
// Create leader index:
305302
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
306-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
307303
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
308304
assertThat(response.isAcknowledged(), is(true));
309305
}
@@ -392,7 +388,6 @@ public void testForgetFollower() throws InterruptedException, IOException {
392388
final Map<String, String> settings = new HashMap<>(2);
393389
final int numberOfShards = randomIntBetween(1, 2);
394390
settings.put("index.number_of_shards", Integer.toString(numberOfShards));
395-
settings.put("index.soft_deletes.enabled", Boolean.TRUE.toString());
396391
createIndexRequest.settings(settings);
397392
final CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
398393
assertThat(response.isAcknowledged(), is(true));
@@ -837,7 +832,6 @@ public void testGetFollowStats() throws Exception {
837832
{
838833
// Create leader index:
839834
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
840-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
841835
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
842836
assertThat(response.isAcknowledged(), is(true));
843837
}
@@ -905,7 +899,6 @@ public void testGetFollowInfos() throws Exception {
905899
{
906900
// Create leader index:
907901
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
908-
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
909902
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
910903
assertThat(response.isAcknowledged(), is(true));
911904
}

client/rest-high-level/src/test/java/org/elasticsearch/client/indices/PutIndexTemplateRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected void assertInstances(org.elasticsearch.action.admin.indices.template.p
109109
throw new UncheckedIOException(e);
110110
}
111111
}
112-
assertThat(serverInstance.mappings().get("_doc"), equalTo(mapping));
112+
assertThat(serverInstance.mappings(), equalTo(mapping));
113113
assertThat(serverInstance.settings(), equalTo(clientTestInstance.settings()));
114114
}
115115

distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersion.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ static int compare(final List<Integer> left, final List<Integer> right) {
6666
return 0;
6767
}
6868

69-
7069
}

distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersionChecker.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
*/
2828
final class JavaVersionChecker {
2929

30-
private JavaVersionChecker() {
31-
}
30+
private JavaVersionChecker() {}
3231

3332
/**
3433
* The main entry point. The exit code is 0 if the Java version is at least 1.8, otherwise the exit code is 1.
@@ -42,9 +41,10 @@ public static void main(final String[] args) {
4241
}
4342
if (JavaVersion.compare(JavaVersion.CURRENT, JavaVersion.JAVA_11) < 0) {
4443
final String message = String.format(
45-
Locale.ROOT,
46-
"the minimum required Java version is 11; your Java version from [%s] does not meet this requirement",
47-
System.getProperty("java.home"));
44+
Locale.ROOT,
45+
"the minimum required Java version is 11; your Java version from [%s] does not meet this requirement",
46+
System.getProperty("java.home")
47+
);
4848
errPrintln(message);
4949
exit(1);
5050
}

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/common/settings/AddFileKeyStoreCommand.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class AddFileKeyStoreCommand extends EnvironmentAwareCommand {
5555
protected void execute(Terminal terminal, OptionSet options, Environment env) throws Exception {
5656
KeyStoreWrapper keystore = KeyStoreWrapper.load(env.configFile());
5757
if (keystore == null) {
58-
if (options.has(forceOption) == false &&
59-
terminal.promptYesNo("The elasticsearch keystore does not exist. Do you want to create it?", false) == false) {
58+
if (options.has(forceOption) == false
59+
&& terminal.promptYesNo("The elasticsearch keystore does not exist. Do you want to create it?", false) == false) {
6060
terminal.println("Exiting without creating keystore.");
6161
return;
6262
}
@@ -87,14 +87,16 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
8787
throw new UserException(ExitCodes.IO_ERROR, "File [" + file.toString() + "] does not exist");
8888
}
8989
if (argumentValues.size() > 2) {
90-
throw new UserException(ExitCodes.USAGE, "Unrecognized extra arguments [" +
91-
String.join(", ", argumentValues.subList(2, argumentValues.size())) + "] after filepath");
90+
throw new UserException(
91+
ExitCodes.USAGE,
92+
"Unrecognized extra arguments [" + String.join(", ", argumentValues.subList(2, argumentValues.size())) + "] after filepath"
93+
);
9294
}
9395
keystore.setFile(setting, Files.readAllBytes(file));
9496
keystore.save(env.configFile(), new char[0]);
9597
}
9698

97-
@SuppressForbidden(reason="file arg for cli")
99+
@SuppressForbidden(reason = "file arg for cli")
98100
private Path getPath(String file) {
99101
return PathUtils.get(file);
100102
}

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/common/settings/AddStringKeyStoreCommand.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ InputStream getStdin() {
5959
protected void execute(Terminal terminal, OptionSet options, Environment env) throws Exception {
6060
KeyStoreWrapper keystore = KeyStoreWrapper.load(env.configFile());
6161
if (keystore == null) {
62-
if (options.has(forceOption) == false &&
63-
terminal.promptYesNo("The elasticsearch keystore does not exist. Do you want to create it?", false) == false) {
62+
if (options.has(forceOption) == false
63+
&& terminal.promptYesNo("The elasticsearch keystore does not exist. Do you want to create it?", false) == false) {
6464
terminal.println("Exiting without creating keystore.");
6565
return;
6666
}
@@ -84,8 +84,10 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
8484

8585
final char[] value;
8686
if (options.has(stdinOption)) {
87-
try (BufferedReader stdinReader = new BufferedReader(new InputStreamReader(getStdin(), StandardCharsets.UTF_8));
88-
CharArrayWriter writer = new CharArrayWriter()) {
87+
try (
88+
BufferedReader stdinReader = new BufferedReader(new InputStreamReader(getStdin(), StandardCharsets.UTF_8));
89+
CharArrayWriter writer = new CharArrayWriter()
90+
) {
8991
int charInt;
9092
while ((charInt = stdinReader.read()) != -1) {
9193
if ((char) charInt == '\r' || (char) charInt == '\n') {

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/common/settings/CreateKeyStoreCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
4646
}
4747
}
4848

49-
5049
char[] password = new char[0];// terminal.readSecret("Enter passphrase (empty for no passphrase): ");
5150
/* TODO: uncomment when entering passwords on startup is supported
5251
char[] passwordRepeat = terminal.readSecret("Enter same passphrase again: ");

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/common/settings/ListKeyStoreCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.common.settings;
2121

22-
2322
import java.util.ArrayList;
2423
import java.util.Collections;
2524
import java.util.List;

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/common/settings/UpgradeKeyStoreCommand.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ protected void execute(final Terminal terminal, final OptionSet options, final E
4040
final KeyStoreWrapper wrapper = KeyStoreWrapper.load(env.configFile());
4141
if (wrapper == null) {
4242
throw new UserException(
43-
ExitCodes.CONFIG,
44-
"keystore does not exist at [" + KeyStoreWrapper.keystorePath(env.configFile()) + "]");
43+
ExitCodes.CONFIG,
44+
"keystore does not exist at [" + KeyStoreWrapper.keystorePath(env.configFile()) + "]"
45+
);
4546
}
4647
wrapper.decrypt(new char[0]);
4748
KeyStoreWrapper.upgrade(wrapper, env.configFile(), new char[0]);

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ protected Command newCommand() {
4343
protected Environment createEnv(Map<String, String> settings) throws UserException {
4444
return env;
4545
}
46+
4647
@Override
4748
InputStream getStdin() {
4849
return input;
@@ -180,10 +181,8 @@ public void testSpecialCharacterInName() throws Exception {
180181
terminal.addSecretInput("value");
181182
final String key = randomAlphaOfLength(4) + '@' + randomAlphaOfLength(4);
182183
final UserException e = expectThrows(UserException.class, () -> execute(key));
183-
final String exceptionString= "Setting name [" + key + "] does not match the allowed setting name pattern [[A-Za-z0-9_\\-.]+]";
184-
assertThat(
185-
e,
186-
hasToString(containsString(exceptionString)));
184+
final String exceptionString = "Setting name [" + key + "] does not match the allowed setting name pattern [[A-Za-z0-9_\\-.]+]";
185+
assertThat(e, hasToString(containsString(exceptionString)));
187186
}
188187

189188
void setInput(String inputStr) {

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/common/settings/KeyStoreCommandTestCase.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ void assertSecureFile(KeyStoreWrapper keystore, String setting, Path file) throw
114114
}
115115
int eof = input.read();
116116
if (eof != -1) {
117-
fail("Found extra bytes in file stream from keystore, expected " + expectedBytes.length +
118-
" bytes but found 0x" + Integer.toHexString(eof));
117+
fail(
118+
"Found extra bytes in file stream from keystore, expected "
119+
+ expectedBytes.length
120+
+ " bytes but found 0x"
121+
+ Integer.toHexString(eof)
122+
);
119123
}
120124
}
121125

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/common/settings/KeyStoreWrapperTests.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void testFileSettingExhaustiveBytes() throws Exception {
8383
KeyStoreWrapper keystore = KeyStoreWrapper.create();
8484
byte[] bytes = new byte[256];
8585
for (int i = 0; i < 256; ++i) {
86-
bytes[i] = (byte)i;
86+
bytes[i] = (byte) i;
8787
}
8888
keystore.setFile("foo", bytes);
8989
keystore.save(env.configFile(), new char[0]);
@@ -110,8 +110,10 @@ public void testDecryptKeyStoreWithWrongPassword() throws Exception {
110110
KeyStoreWrapper keystore = KeyStoreWrapper.create();
111111
keystore.save(env.configFile(), new char[0]);
112112
final KeyStoreWrapper loadedkeystore = KeyStoreWrapper.load(env.configFile());
113-
final SecurityException exception = expectThrows(SecurityException.class,
114-
() -> loadedkeystore.decrypt(new char[]{'i', 'n', 'v', 'a', 'l', 'i', 'd'}));
113+
final SecurityException exception = expectThrows(
114+
SecurityException.class,
115+
() -> loadedkeystore.decrypt(new char[] { 'i', 'n', 'v', 'a', 'l', 'i', 'd' })
116+
);
115117
assertThat(exception.getMessage(), containsString("Keystore has been corrupted or tampered with"));
116118
}
117119

@@ -123,8 +125,10 @@ public void testCannotReadStringFromClosedKeystore() throws Exception {
123125
keystore.close();
124126

125127
assertThat(keystore.getSettingNames(), Matchers.hasItem(KeyStoreWrapper.SEED_SETTING.getKey()));
126-
final IllegalStateException exception = expectThrows(IllegalStateException.class,
127-
() -> keystore.getString(KeyStoreWrapper.SEED_SETTING.getKey()));
128+
final IllegalStateException exception = expectThrows(
129+
IllegalStateException.class,
130+
() -> keystore.getString(KeyStoreWrapper.SEED_SETTING.getKey())
131+
);
128132
assertThat(exception.getMessage(), containsString("closed"));
129133
}
130134

@@ -292,9 +296,13 @@ private void possiblyAlterSecretString(DataOutputStream output, int truncLength)
292296
output.write(secret_value);
293297
}
294298

295-
private void possiblyAlterEncryptedBytes(IndexOutput indexOutput, byte[] salt, byte[] iv, byte[] encryptedBytes, int
296-
truncEncryptedDataLength)
297-
throws Exception {
299+
private void possiblyAlterEncryptedBytes(
300+
IndexOutput indexOutput,
301+
byte[] salt,
302+
byte[] iv,
303+
byte[] encryptedBytes,
304+
int truncEncryptedDataLength
305+
) throws Exception {
298306
indexOutput.writeInt(4 + salt.length + 4 + iv.length + 4 + encryptedBytes.length);
299307
indexOutput.writeInt(salt.length);
300308
indexOutput.writeBytes(salt, salt.length);
@@ -387,7 +395,7 @@ public void testBackcompatV2() throws Exception {
387395
byte[] base64Bytes = Base64.getEncoder().encode(fileBytes);
388396
char[] chars = new char[base64Bytes.length];
389397
for (int i = 0; i < chars.length; ++i) {
390-
chars[i] = (char)base64Bytes[i]; // PBE only stores the lower 8 bits, so this narrowing is ok
398+
chars[i] = (char) base64Bytes[i]; // PBE only stores the lower 8 bits, so this narrowing is ok
391399
}
392400
secretKey = secretFactory.generateSecret(new PBEKeySpec(chars));
393401
keystore.setEntry("file_setting", new KeyStore.SecretKeyEntry(secretKey), protectionParameter);
@@ -437,8 +445,10 @@ public void testStringAndFileDistinction() throws Exception {
437445
public void testLegacyV3() throws GeneralSecurityException, IOException {
438446
final Path configDir = createTempDir();
439447
final Path keystore = configDir.resolve("elasticsearch.keystore");
440-
try (InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
441-
OutputStream os = Files.newOutputStream(keystore)) {
448+
try (
449+
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
450+
OutputStream os = Files.newOutputStream(keystore)
451+
) {
442452
final byte[] buffer = new byte[4096];
443453
int readBytes;
444454
while ((readBytes = is.read(buffer)) > 0) {

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/common/settings/UpgradeKeyStoreCommandTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ protected Environment createEnv(final Map<String, String> settings) {
5050

5151
public void testKeystoreUpgrade() throws Exception {
5252
final Path keystore = KeyStoreWrapper.keystorePath(env.configFile());
53-
try (InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
54-
OutputStream os = Files.newOutputStream(keystore)) {
53+
try (
54+
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
55+
OutputStream os = Files.newOutputStream(keystore)
56+
) {
5557
is.transferTo(os);
5658
}
5759
try (KeyStoreWrapper beforeUpgrade = KeyStoreWrapper.load(env.configFile())) {

0 commit comments

Comments
 (0)