From d12d008781daf87757aa8eaff8f9e577f5a4c68b Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Sat, 2 Jan 2021 23:59:09 +0530 Subject: [PATCH 01/15] Changed default setting --- .../org/elasticsearch/action/support/DestructiveOperations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/action/support/DestructiveOperations.java b/server/src/main/java/org/elasticsearch/action/support/DestructiveOperations.java index 583c34e09641a..e9374cc9a2268 100644 --- a/server/src/main/java/org/elasticsearch/action/support/DestructiveOperations.java +++ b/server/src/main/java/org/elasticsearch/action/support/DestructiveOperations.java @@ -33,7 +33,7 @@ public final class DestructiveOperations { * Setting which controls whether wildcard usage (*, prefix*, _all) is allowed. */ public static final Setting REQUIRES_NAME_SETTING = - Setting.boolSetting("action.destructive_requires_name", false, Property.Dynamic, Property.NodeScope); + Setting.boolSetting("action.destructive_requires_name", true, Property.Dynamic, Property.NodeScope); private volatile boolean destructiveRequiresName; public DestructiveOperations(Settings settings, ClusterSettings clusterSettings) { From 714bb7fd26afbfe6f4e0efb225baec07e822e38b Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Tue, 5 Jan 2021 11:59:11 +0530 Subject: [PATCH 02/15] Make changes in the codebase accordingly --- distribution/src/config/elasticsearch.yml | 6 ------ docs/reference/index-modules/blocks.asciidoc | 2 +- docs/reference/indices/close.asciidoc | 2 +- docs/reference/indices/delete-index.asciidoc | 6 +++--- docs/reference/indices/open-close.asciidoc | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/distribution/src/config/elasticsearch.yml b/distribution/src/config/elasticsearch.yml index a87d7f70825ed..75d5f827b4c06 100644 --- a/distribution/src/config/elasticsearch.yml +++ b/distribution/src/config/elasticsearch.yml @@ -80,9 +80,3 @@ ${path.logs} #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. -# -# ---------------------------------- Various ----------------------------------- -# -# Require explicit names when deleting indices: -# -#action.destructive_requires_name: true diff --git a/docs/reference/index-modules/blocks.asciidoc b/docs/reference/index-modules/blocks.asciidoc index 8431dc8049247..1f03297dab385 100644 --- a/docs/reference/index-modules/blocks.asciidoc +++ b/docs/reference/index-modules/blocks.asciidoc @@ -76,7 +76,7 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + To add blocks to all indices, use `_all` or `*`. To disallow the adding of blocks to indices with `_all` or wildcard expressions, -change the `action.destructive_requires_name` cluster setting to `true`. +the `action.destructive_requires_name` cluster setting must be `true`. You can update this setting in the `elasticsearch.yml` file or using the <> API. ``:: diff --git a/docs/reference/indices/close.asciidoc b/docs/reference/indices/close.asciidoc index f008857d366d6..632283dd5cdf9 100644 --- a/docs/reference/indices/close.asciidoc +++ b/docs/reference/indices/close.asciidoc @@ -34,7 +34,7 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + To close all indices, use `_all` or `*`. To disallow the closing of indices with `_all` or wildcard expressions, -change the `action.destructive_requires_name` cluster setting to `true`. +the `action.destructive_requires_name` cluster setting must be `true`. You can update this setting in the `elasticsearch.yml` file or using the <> API. diff --git a/docs/reference/indices/delete-index.asciidoc b/docs/reference/indices/delete-index.asciidoc index 19112da63d9f2..19613fb955ec2 100644 --- a/docs/reference/indices/delete-index.asciidoc +++ b/docs/reference/indices/delete-index.asciidoc @@ -32,9 +32,9 @@ In this parameter, wildcard expressions match only open, concrete indices. You cannot delete an index using an <>. To delete all indices, use `_all` or `*` . To disallow the deletion of indices -with `_all` or wildcard expressions, change the -`action.destructive_requires_name` cluster setting to `true`. You can update -this setting in the `elasticsearch.yml` file or using the +with `_all` or wildcard expressions, the `action.destructive_requires_name` +cluster setting must be `true`. You can update this setting in the +`elasticsearch.yml` file or using the <> API. NOTE: You cannot delete the current write index of a data stream. To delete the diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index 1490d3895d442..4a9152999588a 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -90,7 +90,7 @@ the request. Wildcard (`*`) expressions are supported. To target all data streams and indices, use `_all` or `*`. + To disallow use of `_all` or wildcard expressions, -change the `action.destructive_requires_name` cluster setting to `true`. +the `action.destructive_requires_name` cluster setting must be `true`. You can update this setting in the `elasticsearch.yml` file or using the <> API. From 9e7b911a21746c9fe382bc205c981d44c78c75c3 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Fri, 8 Jan 2021 15:32:39 +0530 Subject: [PATCH 03/15] Restore deleted section --- distribution/src/config/elasticsearch.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/distribution/src/config/elasticsearch.yml b/distribution/src/config/elasticsearch.yml index 75d5f827b4c06..bbb07dfc6c844 100644 --- a/distribution/src/config/elasticsearch.yml +++ b/distribution/src/config/elasticsearch.yml @@ -80,3 +80,7 @@ ${path.logs} #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. +# +# Allow wildcard deletion of indices: +# +#action.destructive_requires_name: false From e604fb6daed3a68da5599f27cd064f2ada45dc83 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Fri, 8 Jan 2021 15:33:17 +0530 Subject: [PATCH 04/15] Rephrase to reflect default behaviour --- docs/reference/index-modules/blocks.asciidoc | 7 ++++--- docs/reference/indices/close.asciidoc | 5 +++-- docs/reference/indices/delete-index.asciidoc | 8 ++++---- docs/reference/indices/open-close.asciidoc | 5 +++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/reference/index-modules/blocks.asciidoc b/docs/reference/index-modules/blocks.asciidoc index 1f03297dab385..fa3ff474fc560 100644 --- a/docs/reference/index-modules/blocks.asciidoc +++ b/docs/reference/index-modules/blocks.asciidoc @@ -74,9 +74,10 @@ PUT /my-index-000001/_block/write include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + -To add blocks to all indices, use `_all` or `*`. To disallow the adding -of blocks to indices with `_all` or wildcard expressions, -the `action.destructive_requires_name` cluster setting must be `true`. +To close all indices, use `_all` or `*`. +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. ``:: diff --git a/docs/reference/indices/close.asciidoc b/docs/reference/indices/close.asciidoc index 632283dd5cdf9..74c222071c18f 100644 --- a/docs/reference/indices/close.asciidoc +++ b/docs/reference/indices/close.asciidoc @@ -33,8 +33,9 @@ include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index] include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + To close all indices, use `_all` or `*`. -To disallow the closing of indices with `_all` or wildcard expressions, -the `action.destructive_requires_name` cluster setting must be `true`. +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. diff --git a/docs/reference/indices/delete-index.asciidoc b/docs/reference/indices/delete-index.asciidoc index 19613fb955ec2..f31284b75b15c 100644 --- a/docs/reference/indices/delete-index.asciidoc +++ b/docs/reference/indices/delete-index.asciidoc @@ -31,10 +31,10 @@ delete. In this parameter, wildcard expressions match only open, concrete indices. You cannot delete an index using an <>. -To delete all indices, use `_all` or `*` . To disallow the deletion of indices -with `_all` or wildcard expressions, the `action.destructive_requires_name` -cluster setting must be `true`. You can update this setting in the -`elasticsearch.yml` file or using the +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +expressions, change the `action.destructive_requires_name` setting to `false`. +You can update this setting in the `elasticsearch.yml` file or using the <> API. NOTE: You cannot delete the current write index of a data stream. To delete the diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index 4a9152999588a..71efad4042b0d 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -50,8 +50,9 @@ disabled using the `ignore_unavailable=true` parameter. All indices can be opened or closed at once using `_all` as the index name or specifying patterns that identify them all (e.g. `*`). -Identifying indices via wildcards or `_all` can be disabled by setting the -`action.destructive_requires_name` flag in the config file to `true`. +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +expressions, change the `action.destructive_requires_name` setting to `false`. This setting can also be changed via the cluster update settings api. Closed indices consume a significant amount of disk-space which can cause From 8c7204b3d049f3c8fcb386c71b217d8bad26dc32 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Fri, 8 Jan 2021 15:34:08 +0530 Subject: [PATCH 05/15] Set action.destructive_requires_name to false --- .../elasticsearch/gradle/testclusters/ElasticsearchNode.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java index 3b4d762735e83..225001ad8a61d 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java @@ -1186,6 +1186,8 @@ private void createConfiguration() { baseConfig.put("cluster.service.slow_master_task_logging_threshold", "5s"); } + baseConfig.put("action.destructive_requires_name", "false"); + HashSet overriden = new HashSet<>(baseConfig.keySet()); overriden.retainAll(settings.keySet()); overriden.removeAll(OVERRIDABLE_SETTINGS); From ccaec9420cc8ef37260119e653fc37211952fc71 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Fri, 8 Jan 2021 23:02:29 +0530 Subject: [PATCH 06/15] Restore missing line --- distribution/src/config/elasticsearch.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distribution/src/config/elasticsearch.yml b/distribution/src/config/elasticsearch.yml index bbb07dfc6c844..161f3f80bf007 100644 --- a/distribution/src/config/elasticsearch.yml +++ b/distribution/src/config/elasticsearch.yml @@ -81,6 +81,8 @@ ${path.logs} # # For more information, consult the gateway module documentation. # +# ---------------------------------- Various ----------------------------------- +# # Allow wildcard deletion of indices: # #action.destructive_requires_name: false From 875998b049bd8bcdb406bc3349810e6c02ed1c3c Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Fri, 8 Jan 2021 23:06:10 +0530 Subject: [PATCH 07/15] Rephrase some more sections --- docs/reference/index-modules/blocks.asciidoc | 1 - docs/reference/indices/open-close.asciidoc | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/index-modules/blocks.asciidoc b/docs/reference/index-modules/blocks.asciidoc index fa3ff474fc560..d7a4fa6f36253 100644 --- a/docs/reference/index-modules/blocks.asciidoc +++ b/docs/reference/index-modules/blocks.asciidoc @@ -74,7 +74,6 @@ PUT /my-index-000001/_block/write include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + -To close all indices, use `_all` or `*`. By default, you must explicitly name the indices you are adding blocks to. To allow the adding of blocks to indices with `_all`, `*``, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index 71efad4042b0d..6664841a6f9fc 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -90,8 +90,9 @@ the request. Wildcard (`*`) expressions are supported. + To target all data streams and indices, use `_all` or `*`. + -To disallow use of `_all` or wildcard expressions, -the `action.destructive_requires_name` cluster setting must be `true`. +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. From 07a200b236b3cf9e18367444a21da42ab4ec3a5a Mon Sep 17 00:00:00 2001 From: Yash Jipkate <34203227+YashJipkate@users.noreply.github.com> Date: Tue, 12 Jan 2021 00:00:36 +0530 Subject: [PATCH 08/15] Update docs/reference/indices/close.asciidoc Co-authored-by: William Brafford --- docs/reference/indices/close.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/indices/close.asciidoc b/docs/reference/indices/close.asciidoc index 74c222071c18f..1aa5fb00b86ab 100644 --- a/docs/reference/indices/close.asciidoc +++ b/docs/reference/indices/close.asciidoc @@ -33,8 +33,8 @@ include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index] include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index] + To close all indices, use `_all` or `*`. -By default, you must explicitly name the indices you are adding blocks to. -To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +By default, you must explicitly name the indices you are closing. +To specify indices to close with `_all`, `*``, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. From 70bf4f9a878499a48c669b815aaacbca5fd5f3e4 Mon Sep 17 00:00:00 2001 From: Yash Jipkate <34203227+YashJipkate@users.noreply.github.com> Date: Tue, 12 Jan 2021 00:01:58 +0530 Subject: [PATCH 09/15] Apply suggestions from code review Co-authored-by: William Brafford --- docs/reference/indices/delete-index.asciidoc | 4 ++-- docs/reference/indices/open-close.asciidoc | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/reference/indices/delete-index.asciidoc b/docs/reference/indices/delete-index.asciidoc index f31284b75b15c..cada03f82f37e 100644 --- a/docs/reference/indices/delete-index.asciidoc +++ b/docs/reference/indices/delete-index.asciidoc @@ -31,8 +31,8 @@ delete. In this parameter, wildcard expressions match only open, concrete indices. You cannot delete an index using an <>. -By default, you must explicitly name the indices you are adding blocks to. -To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +By default, you must explicitly name the indices you are deleting. +To specify indices to delete with `_all`, `*``, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index 6664841a6f9fc..384cf0964dba0 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -47,11 +47,9 @@ You can open and close multiple indices. An error is thrown if the request explicitly refers to a missing index. This behaviour can be disabled using the `ignore_unavailable=true` parameter. -All indices can be opened or closed at once using `_all` as the index name -or specifying patterns that identify them all (e.g. `*`). -By default, you must explicitly name the indices you are adding blocks to. -To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +By default, you must explicitly name the indices you are opening or closing. +To open or close indices with `_all`, `*``, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. This setting can also be changed via the cluster update settings api. @@ -88,10 +86,9 @@ index creation applies to the `_open` and `_close` index actions as well. Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. + -To target all data streams and indices, use `_all` or `*`. + -By default, you must explicitly name the indices you are adding blocks to. -To allow the adding of blocks to indices with `_all`, `*``, or other wildcard +By default, you must explicitly name the indices you using to limit the request. +To limit a request using `_all`, `*``, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. You can update this setting in the `elasticsearch.yml` file or using the <> API. From 311248d20e5a6279dad91b2197bc5d4f9a061b80 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Tue, 12 Jan 2021 00:18:23 +0530 Subject: [PATCH 10/15] Add REQUIRES_NAME_SETTING setting in ESSingleNodeTestCase --- .../main/java/org/elasticsearch/test/ESSingleNodeTestCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java index f87bce6784688..416af04340c22 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java @@ -23,6 +23,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.get.GetIndexResponse; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; @@ -197,6 +198,7 @@ private Node newNode() { Settings settings = Settings.builder() .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), InternalTestCluster.clusterName("single-node-cluster", random().nextLong())) + .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) .put(Environment.PATH_HOME_SETTING.getKey(), tempDir) .put(Environment.PATH_REPO_SETTING.getKey(), tempDir.resolve("repo")) // TODO: use a consistent data path for custom paths From ac7227ee1140638539e2bdfbbb33d4dd9f24df37 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Wed, 13 Jan 2021 12:58:35 +0530 Subject: [PATCH 11/15] Try fixing tests --- .../test/java/org/elasticsearch/packaging/util/ServerUtils.java | 2 +- qa/remote-clusters/docker-compose-oss.yml | 2 ++ qa/remote-clusters/docker-compose.yml | 2 ++ .../src/main/java/org/elasticsearch/test/ESIntegTestCase.java | 2 ++ .../main/java/org/elasticsearch/test/InternalTestCluster.java | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/util/ServerUtils.java b/qa/os/src/test/java/org/elasticsearch/packaging/util/ServerUtils.java index 426461e9fdd64..4541b68cc5d7c 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/util/ServerUtils.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/util/ServerUtils.java @@ -240,7 +240,7 @@ public static void runElasticsearchTests() throws Exception { String count = makeRequest(Request.Get("http://localhost:9200/_count?pretty")); assertThat(count, containsString("\"count\" : 2")); - makeRequest(Request.Delete("http://localhost:9200/_all")); + makeRequest(Request.Delete("http://localhost:9200/library")); } public static String makeRequest(Request request) throws Exception { diff --git a/qa/remote-clusters/docker-compose-oss.yml b/qa/remote-clusters/docker-compose-oss.yml index 1a77d1bc9999d..d6b0e07441e33 100644 --- a/qa/remote-clusters/docker-compose-oss.yml +++ b/qa/remote-clusters/docker-compose-oss.yml @@ -16,6 +16,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false + - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-1:/usr/share/elasticsearch/logs @@ -50,6 +51,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false + - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-2:/usr/share/elasticsearch/logs diff --git a/qa/remote-clusters/docker-compose.yml b/qa/remote-clusters/docker-compose.yml index debf863c58067..1a6277dbbd319 100644 --- a/qa/remote-clusters/docker-compose.yml +++ b/qa/remote-clusters/docker-compose.yml @@ -30,6 +30,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial + - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem @@ -82,6 +83,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial + - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index 6d1026ebbaa42..33b522981cbad 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -55,6 +55,7 @@ import org.elasticsearch.action.search.ClearScrollResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.DefaultShardOperationFailedException; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; @@ -1744,6 +1745,7 @@ protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder builder = Settings.builder() // Default the watermarks to absurdly low to prevent the tests // from failing on nodes without enough disk space + .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "1b") diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index a85d7a12c51eb..13c1438536c19 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -36,6 +36,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.action.support.replication.TransportReplicationAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterName; @@ -398,6 +399,7 @@ public InternalTestCluster( // TODO: currently we only randomize "cluster.no_master_block" between "write" and "metadata_write", as "all" is fragile // and fails shards when a master abdicates, which breaks many tests. builder.put(NoMasterBlockService.NO_MASTER_BLOCK_SETTING.getKey(), randomFrom(random,"write", "metadata_write")); + builder.put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false); defaultSettings = builder.build(); executor = EsExecutors.newScaling("internal_test_cluster_executor", 0, Integer.MAX_VALUE, 0, TimeUnit.SECONDS, EsExecutors.daemonThreadFactory("test_" + clusterName), new ThreadContext(Settings.EMPTY)); From 2d9054f779914fb179f725d4ccd6d2a167f897dd Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Wed, 13 Jan 2021 13:44:42 +0530 Subject: [PATCH 12/15] Update restClientSettings --- .../org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java index 59980dd361fa7..f611a3424e07a 100644 --- a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java +++ b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java @@ -19,6 +19,7 @@ package org.elasticsearch.docker.test; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.client.Request; import org.elasticsearch.common.CharArrays; @@ -129,6 +130,7 @@ protected Settings restClientSettings() { } String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray())); return Settings.builder() + .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) .put(ThreadContext.PREFIX + ".Authorization", token) .put(ESRestTestCase.CERTIFICATE_AUTHORITIES, trustedCertFile) .build(); From caf78aef348492a1be895e0dc55e15ffc2e3f873 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Wed, 13 Jan 2021 14:23:48 +0530 Subject: [PATCH 13/15] Update super restClientSettings --- .../main/java/org/elasticsearch/test/rest/ESRestTestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index e36fee2352042..414db53e93fd8 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -34,6 +34,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksAction; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.client.Request; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions.Builder; @@ -972,7 +973,7 @@ protected Settings restClientSettings() { if (System.getProperty("tests.rest.client_path_prefix") != null) { builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix")); } - return builder.build(); + return builder.put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false).build(); } /** From 09b0e61f0bc09eb63a2316956067b8953934b67f Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Wed, 13 Jan 2021 15:22:15 +0530 Subject: [PATCH 14/15] Revert updates in restClientSettings --- .../org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java | 2 -- .../main/java/org/elasticsearch/test/rest/ESRestTestCase.java | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java index f611a3424e07a..59980dd361fa7 100644 --- a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java +++ b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java @@ -19,7 +19,6 @@ package org.elasticsearch.docker.test; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; -import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.client.Request; import org.elasticsearch.common.CharArrays; @@ -130,7 +129,6 @@ protected Settings restClientSettings() { } String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray())); return Settings.builder() - .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) .put(ThreadContext.PREFIX + ".Authorization", token) .put(ESRestTestCase.CERTIFICATE_AUTHORITIES, trustedCertFile) .build(); diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index 414db53e93fd8..e36fee2352042 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -34,7 +34,6 @@ import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksAction; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.client.Request; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions.Builder; @@ -973,7 +972,7 @@ protected Settings restClientSettings() { if (System.getProperty("tests.rest.client_path_prefix") != null) { builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix")); } - return builder.put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false).build(); + return builder.build(); } /** From b212bcb325a38dcad876673459cf4f128e3c9379 Mon Sep 17 00:00:00 2001 From: YashJipkate Date: Wed, 13 Jan 2021 21:51:52 +0530 Subject: [PATCH 15/15] Try fixing tests --- distribution/docker/docker-compose.yml | 4 ++++ qa/remote-clusters/docker-compose-oss.yml | 4 ++-- qa/remote-clusters/docker-compose.yml | 4 ++-- .../src/main/java/org/elasticsearch/test/ESIntegTestCase.java | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/distribution/docker/docker-compose.yml b/distribution/docker/docker-compose.yml index a963ed08d51f9..d00c6aa5a9870 100644 --- a/distribution/docker/docker-compose.yml +++ b/distribution/docker/docker-compose.yml @@ -30,6 +30,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial + - action.destructive_requires_name=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem @@ -81,6 +82,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial + - action.destructive_requires_name=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem @@ -118,6 +120,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false + - action.destructive_requires_name=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-1:/usr/share/elasticsearch/logs @@ -151,6 +154,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false + - action.destructive_requires_name=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-2:/usr/share/elasticsearch/logs diff --git a/qa/remote-clusters/docker-compose-oss.yml b/qa/remote-clusters/docker-compose-oss.yml index d6b0e07441e33..911058f123a6d 100644 --- a/qa/remote-clusters/docker-compose-oss.yml +++ b/qa/remote-clusters/docker-compose-oss.yml @@ -16,7 +16,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false - - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false + - action.destructive_requires_name=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-1:/usr/share/elasticsearch/logs @@ -51,7 +51,7 @@ services: - cluster.routing.allocation.disk.watermark.high=1b - cluster.routing.allocation.disk.watermark.flood_stage=1b - node.store.allow_mmap=false - - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false + - action.destructive_requires_name=false volumes: - ./build/oss-repo:/tmp/es-repo - ./build/logs/oss-2:/usr/share/elasticsearch/logs diff --git a/qa/remote-clusters/docker-compose.yml b/qa/remote-clusters/docker-compose.yml index 1a6277dbbd319..bcbbe9c37d259 100644 --- a/qa/remote-clusters/docker-compose.yml +++ b/qa/remote-clusters/docker-compose.yml @@ -30,7 +30,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial - - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false + - action.destructive_requires_name=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem @@ -83,7 +83,7 @@ services: - xpack.http.ssl.verification_mode=certificate - xpack.security.transport.ssl.verification_mode=certificate - xpack.license.self_generated.type=trial - - action.support.DestructiveOperations.REQUIRES_NAME_SETTING=false + - action.destructive_requires_name=false volumes: - ./build/repo:/tmp/es-repo - ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index 33b522981cbad..456c755fbf6f4 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -1743,9 +1743,9 @@ private int getNumClientNodes() { */ protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder builder = Settings.builder() + .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) // Default the watermarks to absurdly low to prevent the tests // from failing on nodes without enough disk space - .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false) .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "1b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "1b")