Skip to content

Commit b900247

Browse files
authored
Deprecate repositories.s3 settings (#23278)
Global repositories settings we were able to set in elasticsearch config file under `repositories.s3` name space are now deprecated and will be removed in master (6.x). This includes `repositories.s3.bucket`, `repositories.s3.server_side_encryption`, `repositories.s3.buffer_size`, `repositories.s3.max_retries`, `repositories.s3.use_throttle_retries`, `repositories.s3.chunk_size`, `repositories.s3.compress`, `repositories.s3.storage_class`, `repositories.s3.canned_acl`, `repositories.s3.base_path` and `repositories.s3.path_style_access`. We must set those settings per repository instead. Respectively `bucket`, `server_side_encryption`, `buffer_size`, `max_retries`, `use_throttle_retries`, `chunk_size`, `compress`, `storage_class`, `canned_acl`, `base_path` and `path_style_access`. Related to #22800
1 parent 7fb9038 commit b900247

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

docs/plugins/repository-s3.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ The following settings are supported:
268268
The default behaviour is to detect which access style to use based on the configured endpoint (an IP will result
269269
in path-style access) and the bucket being accessed (some buckets are not valid DNS names).
270270

271-
Note that you can define S3 repository settings for all S3 repositories in `elasticsearch.yml` configuration file.
272-
They are all prefixed with `repositories.s3.`. For example, you can define compression for all S3 repositories
273-
by setting `repositories.s3.compress: true` in `elasticsearch.yml`.
274-
275271
The S3 repositories use the same credentials as the rest of the AWS services
276272
provided by this plugin (`discovery`). See <<repository-s3-usage>> for details.
277273

plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public class S3Repository extends BlobStoreRepository {
107107
* Global S3 repositories settings. Starting with: repositories.s3
108108
* NOTE: These are legacy settings. Use the named client config settings above.
109109
*/
110+
@Deprecated
110111
public interface Repositories {
111112
/**
112113
* repositories.s3.access_key: AWS Access key specific for all S3 Repositories API calls. Defaults to cloud.aws.s3.access_key.
@@ -143,13 +144,13 @@ public interface Repositories {
143144
/**
144145
* repositories.s3.bucket: The name of the bucket to be used for snapshots.
145146
*/
146-
Setting<String> BUCKET_SETTING = Setting.simpleString("repositories.s3.bucket", Property.NodeScope);
147+
Setting<String> BUCKET_SETTING = Setting.simpleString("repositories.s3.bucket", Property.NodeScope, Property.Deprecated);
147148
/**
148149
* repositories.s3.server_side_encryption: When set to true files are encrypted on server side using AES256 algorithm.
149150
* Defaults to false.
150151
*/
151152
Setting<Boolean> SERVER_SIDE_ENCRYPTION_SETTING =
152-
Setting.boolSetting("repositories.s3.server_side_encryption", false, Property.NodeScope);
153+
Setting.boolSetting("repositories.s3.server_side_encryption", false, Property.NodeScope, Property.Deprecated);
153154

154155
/**
155156
* Default is to use 100MB (S3 defaults) for heaps above 2GB and 5% of
@@ -171,41 +172,41 @@ public interface Repositories {
171172
*/
172173
Setting<ByteSizeValue> BUFFER_SIZE_SETTING =
173174
Setting.byteSizeSetting("repositories.s3.buffer_size", DEFAULT_BUFFER_SIZE,
174-
new ByteSizeValue(5, ByteSizeUnit.MB), new ByteSizeValue(5, ByteSizeUnit.TB), Property.NodeScope);
175+
new ByteSizeValue(5, ByteSizeUnit.MB), new ByteSizeValue(5, ByteSizeUnit.TB), Property.NodeScope, Property.Deprecated);
175176
/**
176177
* repositories.s3.max_retries: Number of retries in case of S3 errors. Defaults to 3.
177178
*/
178-
Setting<Integer> MAX_RETRIES_SETTING = Setting.intSetting("repositories.s3.max_retries", 3, Property.NodeScope);
179+
Setting<Integer> MAX_RETRIES_SETTING = Setting.intSetting("repositories.s3.max_retries", 3, Property.NodeScope, Property.Deprecated);
179180
/**
180181
* repositories.s3.use_throttle_retries: Set to `true` if you want to throttle retries. Defaults to AWS SDK default value (`false`).
181182
*/
182183
Setting<Boolean> USE_THROTTLE_RETRIES_SETTING = Setting.boolSetting("repositories.s3.use_throttle_retries",
183-
ClientConfiguration.DEFAULT_THROTTLE_RETRIES, Property.NodeScope);
184+
ClientConfiguration.DEFAULT_THROTTLE_RETRIES, Property.NodeScope, Property.Deprecated);
184185
/**
185186
* repositories.s3.chunk_size: Big files can be broken down into chunks during snapshotting if needed. Defaults to 1g.
186187
*/
187188
Setting<ByteSizeValue> CHUNK_SIZE_SETTING =
188189
Setting.byteSizeSetting("repositories.s3.chunk_size", new ByteSizeValue(1, ByteSizeUnit.GB),
189-
new ByteSizeValue(5, ByteSizeUnit.MB), new ByteSizeValue(5, ByteSizeUnit.TB), Property.NodeScope);
190+
new ByteSizeValue(5, ByteSizeUnit.MB), new ByteSizeValue(5, ByteSizeUnit.TB), Property.NodeScope, Property.Deprecated);
190191
/**
191192
* repositories.s3.compress: When set to true metadata files are stored in compressed format. This setting doesn’t affect index
192193
* files that are already compressed by default. Defaults to false.
193194
*/
194-
Setting<Boolean> COMPRESS_SETTING = Setting.boolSetting("repositories.s3.compress", false, Property.NodeScope);
195+
Setting<Boolean> COMPRESS_SETTING = Setting.boolSetting("repositories.s3.compress", false, Property.NodeScope, Property.Deprecated);
195196
/**
196197
* repositories.s3.storage_class: Sets the S3 storage class type for the backup files. Values may be standard, reduced_redundancy,
197198
* standard_ia. Defaults to standard.
198199
*/
199-
Setting<String> STORAGE_CLASS_SETTING = Setting.simpleString("repositories.s3.storage_class", Property.NodeScope);
200+
Setting<String> STORAGE_CLASS_SETTING = Setting.simpleString("repositories.s3.storage_class", Property.NodeScope, Property.Deprecated);
200201
/**
201202
* repositories.s3.canned_acl: The S3 repository supports all S3 canned ACLs : private, public-read, public-read-write,
202203
* authenticated-read, log-delivery-write, bucket-owner-read, bucket-owner-full-control. Defaults to private.
203204
*/
204-
Setting<String> CANNED_ACL_SETTING = Setting.simpleString("repositories.s3.canned_acl", Property.NodeScope);
205+
Setting<String> CANNED_ACL_SETTING = Setting.simpleString("repositories.s3.canned_acl", Property.NodeScope, Property.Deprecated);
205206
/**
206207
* repositories.s3.base_path: Specifies the path within bucket to repository data. Defaults to root directory.
207208
*/
208-
Setting<String> BASE_PATH_SETTING = Setting.simpleString("repositories.s3.base_path", Property.NodeScope);
209+
Setting<String> BASE_PATH_SETTING = Setting.simpleString("repositories.s3.base_path", Property.NodeScope, Property.Deprecated);
209210
/**
210211
* repositories.s3.path_style_access: When set to true configures the client to use path-style access for all requests.
211212
Amazon S3 supports virtual-hosted-style and path-style access in all Regions. The path-style syntax, however,
@@ -214,7 +215,8 @@ The default behaviour is to detect which access style to use based on the config
214215
in path-style access) and the bucket being accessed (some buckets are not valid DNS names). Setting this flag
215216
will result in path-style access being used for all requests.
216217
*/
217-
Setting<Boolean> PATH_STYLE_ACCESS_SETTING = Setting.boolSetting("repositories.s3.path_style_access", false, Property.NodeScope);
218+
Setting<Boolean> PATH_STYLE_ACCESS_SETTING = Setting.boolSetting("repositories.s3.path_style_access", false, Property.NodeScope,
219+
Property.Deprecated);
218220
}
219221

220222
/**

plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public void testGlobalMaxRetries() {
284284
.build();
285285
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTPS, null, -1, null,
286286
null, null, 10, false, 50000);
287+
assertSettingDeprecationsAndWarnings(new Setting<?>[]{S3Repository.Repositories.MAX_RETRIES_SETTING});
287288
}
288289

289290
public void testRepositoryMaxRetries() {

plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ public void testBasePathSetting() throws IOException {
125125
Settings settings = Settings.builder().put(Repositories.BASE_PATH_SETTING.getKey(), "/foo/bar").build();
126126
s3repo = new S3Repository(metadata, settings, NamedXContentRegistry.EMPTY, new DummyS3Service());
127127
assertEquals("foo/bar/", s3repo.basePath().buildAsString()); // make sure leading `/` is removed and trailing is added
128-
assertWarnings("S3 repository base_path" +
129-
" trimming the leading `/`, and leading `/` will not be supported for the S3 repository in future releases");
128+
assertSettingDeprecationsAndWarnings(new Setting<?>[]{Repositories.BASE_PATH_SETTING},
129+
"S3 repository base_path trimming the leading `/`, and leading `/` will not be supported for the S3 repository in " +
130+
"future releases");
130131
}
131132

132133
public void testDefaultBufferSize() {

0 commit comments

Comments
 (0)