From c61cb60feca4e69facaa84b4dad655a3c2de891b Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 30 Jan 2017 11:03:52 +0100 Subject: [PATCH 1/2] Deprecate global `repositories.azure` settings Today we have multiple ways to define settings when a user needs to create a repository: * in `elasticsearch.yml` file using `repositories.azure` prefix * when creating the repository itself with `PUT _snaphot/repo` The plan is to: * Deprecate `repositories.azure` settings in 5.x (this PR) * Remove in 6.x (master branch) Related to #22800 Also adds a `deprecated` section in our docs as per #22849. --- docs/plugins/repository-azure.asciidoc | 16 -------- docs/reference/migration/index.asciidoc | 5 ++- docs/reference/migration/migrate_5_3.asciidoc | 39 +++++++++++++++++++ .../azure/storage/AzureStorageService.java | 20 +++++++--- .../azure/AzureRepositorySettingsTests.java | 21 ++++++++++ 5 files changed, 78 insertions(+), 23 deletions(-) diff --git a/docs/plugins/repository-azure.asciidoc b/docs/plugins/repository-azure.asciidoc index a1f8c6ea81d57..b3b4103dcdbe0 100644 --- a/docs/plugins/repository-azure.asciidoc +++ b/docs/plugins/repository-azure.asciidoc @@ -185,22 +185,6 @@ client.admin().cluster().preparePutRepository("my_backup_java1") ).get(); ---- -[[repository-azure-global-settings]] -===== Global repositories settings - -All those repository settings can also be defined globally in `elasticsearch.yml` file using prefix -`repositories.azure.`. For example: - -[source,yaml] ----- -repositories.azure: - container: backup-container - base_path: backups - chunk_size: 32m - compress": true ----- - - [[repository-azure-validation]] ===== Repository validation rules diff --git a/docs/reference/migration/index.asciidoc b/docs/reference/migration/index.asciidoc index cf7593efed627..c81f669ff3ba2 100644 --- a/docs/reference/migration/index.asciidoc +++ b/docs/reference/migration/index.asciidoc @@ -1,11 +1,14 @@ [[breaking-changes]] -= Breaking changes += Breaking changes and depreciations [partintro] -- This section discusses the changes that you need to be aware of when migrating your application from one version of Elasticsearch to another. +It also helps to move away from deprecating settings and features before they will get removed +in a next major version. + As a general rule: * Migration between minor versions -- e.g. `5.x` to `5.y` -- can be diff --git a/docs/reference/migration/migrate_5_3.asciidoc b/docs/reference/migration/migrate_5_3.asciidoc index 5364072b679de..5b0b82d50ea88 100644 --- a/docs/reference/migration/migrate_5_3.asciidoc +++ b/docs/reference/migration/migrate_5_3.asciidoc @@ -53,3 +53,42 @@ is deprecated. Usage of any value other than `false`, `"false", `true` and `"true"` for boolean values in mappings is deprecated. +[[deprecated_53]] +== Deprecated in 5.3 + +[[deprecated_53_settings_changes]] +[float] +=== Settings changes + +[float] +==== Repository Azure plugin + +Global repositories settings you are able to set in elasticsearch config file under `repositories.azure` +name space are now deprecated. You must set those settings per repository instead. +See {plugins}/repository-azure-usage.html#repository-azure-repository-settings[Azure Repository settings]. + + +.Deprecated settings +|=== +|Old setting |New setting + +|`repositories.azure.account` +|`account` + +|`repositories.azure.container` +|`container` + +|`repositories.azure.base_path` +|`base_path` + +|`repositories.azure.location_mode` +|`location_mode` + +|`repositories.azure.chunk_size` +|`chunk_size` + +|`repositories.azure.compress` +|`compress` +|=== + + diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java index 6343541aed323..aebfb623fda5d 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java @@ -53,18 +53,26 @@ final class Storage { public static final Setting TIMEOUT_SETTING = Setting.timeSetting("cloud.azure.storage.timeout", TimeValue.timeValueMinutes(-1), Property.NodeScope); + @Deprecated public static final Setting ACCOUNT_SETTING = - Setting.simpleString("repositories.azure.account", Property.NodeScope, Property.Filtered); + Setting.simpleString("repositories.azure.account", Property.NodeScope, Property.Filtered, Property.Deprecated); + @Deprecated public static final Setting CONTAINER_SETTING = - new Setting<>("repositories.azure.container", "elasticsearch-snapshots", Function.identity(), Property.NodeScope); + new Setting<>("repositories.azure.container", "elasticsearch-snapshots", Function.identity(), Property.NodeScope, + Property.Deprecated); + @Deprecated public static final Setting BASE_PATH_SETTING = - Setting.simpleString("repositories.azure.base_path", Property.NodeScope); + Setting.simpleString("repositories.azure.base_path", Property.NodeScope, Property.Deprecated); + @Deprecated public static final Setting LOCATION_MODE_SETTING = - Setting.simpleString("repositories.azure.location_mode", Property.NodeScope); + Setting.simpleString("repositories.azure.location_mode", Property.NodeScope, Property.Deprecated); + @Deprecated public static final Setting CHUNK_SIZE_SETTING = - Setting.byteSizeSetting("repositories.azure.chunk_size", MAX_CHUNK_SIZE, MIN_CHUNK_SIZE, MAX_CHUNK_SIZE, Property.NodeScope); + Setting.byteSizeSetting("repositories.azure.chunk_size", MAX_CHUNK_SIZE, MIN_CHUNK_SIZE, MAX_CHUNK_SIZE, Property.NodeScope, + Property.Deprecated); + @Deprecated public static final Setting COMPRESS_SETTING = - Setting.boolSetting("repositories.azure.compress", false, Property.NodeScope); + Setting.boolSetting("repositories.azure.compress", false, Property.NodeScope, Property.Deprecated); } boolean doesContainerExist(String account, LocationMode mode, String container); diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java index 014fa88cc4d8d..4ea0a6eda35bc 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java @@ -21,6 +21,7 @@ import com.microsoft.azure.storage.LocationMode; import com.microsoft.azure.storage.StorageException; +import org.apache.logging.log4j.core.net.Protocol; import org.elasticsearch.cloud.azure.storage.AzureStorageService; import org.elasticsearch.cluster.metadata.RepositoryMetaData; import org.elasticsearch.common.settings.Settings; @@ -124,4 +125,24 @@ public void testChunkSize() throws StorageException, IOException, URISyntaxExcep azureRepository(Settings.builder().put("chunk_size", "65mb").build())); assertEquals("Failed to parse value [65mb] for setting [chunk_size] must be <= 64mb", e.getMessage()); } + + public void testDeprecatedRepositoriesSettings() throws StorageException, IOException, URISyntaxException { + Settings settings = Settings.builder() + .put(AzureStorageService.Storage.ACCOUNT_SETTING.getKey(), "account") + .put(AzureStorageService.Storage.BASE_PATH_SETTING.getKey(), "path") + .put(AzureStorageService.Storage.CHUNK_SIZE_SETTING.getKey(), AzureStorageService.MAX_CHUNK_SIZE) + .put(AzureStorageService.Storage.COMPRESS_SETTING.getKey(), false) + .put(AzureStorageService.Storage.CONTAINER_SETTING.getKey(), "container") + .put(AzureStorageService.Storage.LOCATION_MODE_SETTING.getKey(), "primary_only") + .build(); + azureRepository(settings); + assertWarnings("[" + AzureStorageService.Storage.ACCOUNT_SETTING.getKey() + "] setting was deprecated", + "[" + AzureStorageService.Storage.BASE_PATH_SETTING.getKey() + "] setting was deprecated", + "[" + AzureStorageService.Storage.CHUNK_SIZE_SETTING.getKey() + "] setting was deprecated", + "[" + AzureStorageService.Storage.COMPRESS_SETTING.getKey() + "] setting was deprecated", + "[" + AzureStorageService.Storage.CONTAINER_SETTING.getKey() + "] setting was deprecated", + "[" + AzureStorageService.Storage.LOCATION_MODE_SETTING.getKey() + "] setting was deprecated"); + } + + } From 26a220521d36428710d99eb440545528a5110c12 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 17 Feb 2017 09:18:59 +0100 Subject: [PATCH 2/2] Revert adding deprecate info in our docs --- docs/reference/migration/index.asciidoc | 5 +-- docs/reference/migration/migrate_5_3.asciidoc | 39 ------------------- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/docs/reference/migration/index.asciidoc b/docs/reference/migration/index.asciidoc index c81f669ff3ba2..cf7593efed627 100644 --- a/docs/reference/migration/index.asciidoc +++ b/docs/reference/migration/index.asciidoc @@ -1,14 +1,11 @@ [[breaking-changes]] -= Breaking changes and depreciations += Breaking changes [partintro] -- This section discusses the changes that you need to be aware of when migrating your application from one version of Elasticsearch to another. -It also helps to move away from deprecating settings and features before they will get removed -in a next major version. - As a general rule: * Migration between minor versions -- e.g. `5.x` to `5.y` -- can be diff --git a/docs/reference/migration/migrate_5_3.asciidoc b/docs/reference/migration/migrate_5_3.asciidoc index 5b0b82d50ea88..5364072b679de 100644 --- a/docs/reference/migration/migrate_5_3.asciidoc +++ b/docs/reference/migration/migrate_5_3.asciidoc @@ -53,42 +53,3 @@ is deprecated. Usage of any value other than `false`, `"false", `true` and `"true"` for boolean values in mappings is deprecated. -[[deprecated_53]] -== Deprecated in 5.3 - -[[deprecated_53_settings_changes]] -[float] -=== Settings changes - -[float] -==== Repository Azure plugin - -Global repositories settings you are able to set in elasticsearch config file under `repositories.azure` -name space are now deprecated. You must set those settings per repository instead. -See {plugins}/repository-azure-usage.html#repository-azure-repository-settings[Azure Repository settings]. - - -.Deprecated settings -|=== -|Old setting |New setting - -|`repositories.azure.account` -|`account` - -|`repositories.azure.container` -|`container` - -|`repositories.azure.base_path` -|`base_path` - -|`repositories.azure.location_mode` -|`location_mode` - -|`repositories.azure.chunk_size` -|`chunk_size` - -|`repositories.azure.compress` -|`compress` -|=== - -