From 072203cba8cfc45d5aab5fed8084c041a20f2412 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Thu, 23 Jan 2020 16:31:47 -0500 Subject: [PATCH] Clean soft-deletes setting in ccr tests (#51113) (#51372) We no longer need to explicitly enable soft-deletes in CCR tests. Relates #50775 Backport of #51113 --- .../java/org/elasticsearch/client/CCRIT.java | 3 - .../documentation/CCRDocumentationIT.java | 7 -- .../xpack/ccr/FollowIndexIT.java | 8 +- .../elasticsearch/xpack/ccr/AutoFollowIT.java | 20 +---- .../org/elasticsearch/xpack/ccr/ChainIT.java | 5 +- .../xpack/ccr/FollowIndexIT.java | 5 +- .../elasticsearch/xpack/ccr/XPackUsageIT.java | 7 +- .../elasticsearch/xpack/ccr/RestartIT.java | 4 +- .../xpack/ccr/FollowIndexSecurityIT.java | 18 +---- .../elasticsearch/xpack/CcrIntegTestCase.java | 4 + .../xpack/ccr/CcrRepositoryIT.java | 18 ++--- .../xpack/ccr/CcrRetentionLeaseIT.java | 18 +---- .../xpack/ccr/CloseFollowerIndexIT.java | 4 +- .../xpack/ccr/FollowerFailOverIT.java | 11 +-- .../xpack/ccr/IndexFollowingIT.java | 75 ++++++------------- .../xpack/ccr/RestartIndexFollowingIT.java | 5 +- .../action/AutoFollowCoordinatorTests.java | 12 +-- .../TransportResumeFollowActionTests.java | 24 ++---- .../index/engine/FollowingEngineTests.java | 12 +-- .../xpack/ilm/CCRIndexLifecycleIT.java | 7 -- 20 files changed, 63 insertions(+), 204 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java index af336061fa7..9adb9bff9ac 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java @@ -76,7 +76,6 @@ public class CCRIT extends ESRestHighLevelClientTestCase { CcrClient ccrClient = highLevelClient().ccr(); CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); @@ -193,7 +192,6 @@ public class CCRIT extends ESRestHighLevelClientTestCase { final int numberOfShards = randomIntBetween(1, 2); settings.put("index.number_of_replicas", "0"); settings.put("index.number_of_shards", Integer.toString(numberOfShards)); - settings.put("index.soft_deletes.enabled", Boolean.TRUE.toString()); createIndexRequest.settings(settings); final CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); @@ -252,7 +250,6 @@ public class CCRIT extends ESRestHighLevelClientTestCase { assertThat(putAutoFollowPatternResponse.isAcknowledged(), is(true)); CreateIndexRequest createIndexRequest = new CreateIndexRequest("logs-20200101"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CCRDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CCRDocumentationIT.java index 643a8d93b45..48b1b1aaa95 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CCRDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CCRDocumentationIT.java @@ -80,7 +80,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } @@ -161,7 +160,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } @@ -227,7 +225,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } @@ -303,7 +300,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } @@ -392,7 +388,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { final Map settings = new HashMap<>(2); final int numberOfShards = randomIntBetween(1, 2); settings.put("index.number_of_shards", Integer.toString(numberOfShards)); - settings.put("index.soft_deletes.enabled", Boolean.TRUE.toString()); createIndexRequest.settings(settings); final CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); @@ -839,7 +834,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } @@ -907,7 +901,6 @@ public class CCRDocumentationIT extends ESRestHighLevelClientTestCase { { // Create leader index: CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader"); - createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true)); CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); assertThat(response.isAcknowledged(), is(true)); } diff --git a/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java b/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java index 4e46de95adb..cc8d399776e 100644 --- a/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java +++ b/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java @@ -9,11 +9,9 @@ import org.apache.lucene.util.Constants; import org.elasticsearch.client.Request; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.JsonLogLine; import org.elasticsearch.common.logging.JsonLogsStream; -import org.elasticsearch.common.settings.Settings; import org.hamcrest.FeatureMatcher; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -114,12 +112,8 @@ public class FollowIndexIT extends ESCCRRestTestCase { } private void createNewIndexAndIndexDocs(RestClient client, String index) throws IOException { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); Request request = new Request("PUT", "/" + index); - request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); + request.setJsonEntity("{\"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(client.performRequest(request)); for (int i = 0; i < 5; i++) { diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java index 055c536faac..cad4ffb314b 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java @@ -8,8 +8,6 @@ package org.elasticsearch.xpack.ccr; import org.elasticsearch.client.Request; import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.Settings; import java.io.IOException; import java.util.Map; @@ -33,12 +31,8 @@ public class AutoFollowIT extends ESCCRRestTestCase { putPatternRequest.setJsonEntity("{\"leader_index_patterns\": [\"logs-*\"], \"remote_cluster\": \"middle_cluster\"}"); assertOK(client().performRequest(putPatternRequest)); try (RestClient leaderClient = buildLeaderClient()) { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); Request request = new Request("PUT", "/logs-20190101"); - request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); + request.setJsonEntity("{\"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(leaderClient.performRequest(request)); for (int i = 0; i < 5; i++) { String id = Integer.toString(i); @@ -46,12 +40,8 @@ public class AutoFollowIT extends ESCCRRestTestCase { } } try (RestClient middleClient = buildMiddleClient()) { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); Request request = new Request("PUT", "/logs-20200101"); - request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); + request.setJsonEntity("{\"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(middleClient.performRequest(request)); for (int i = 0; i < 5; i++) { String id = Integer.toString(i); @@ -80,12 +70,8 @@ public class AutoFollowIT extends ESCCRRestTestCase { assertOK(client().performRequest(request)); try (RestClient leaderClient = buildLeaderClient()) { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); request = new Request("PUT", "/metrics-20210101"); - request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); + request.setJsonEntity("{\"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(leaderClient.performRequest(request)); for (int i = 0; i < 5; i++) { diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java index b3e6384f7f6..72ae8764e70 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java @@ -25,10 +25,7 @@ public class ChainIT extends ESCCRRestTestCase { " \"excludes\": [\"filtered_field\"]" + "}"; } - Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); - createIndex(leaderIndexName, indexSettings, mapping); + createIndex(leaderIndexName, Settings.EMPTY, mapping); for (int i = 0; i < numDocs; i++) { logger.info("Indexing doc [{}]", i); index(client(), leaderIndexName, Integer.toString(i), "field", i, "filtered_field", "true"); diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java index b50fe9233e8..61b3c8b1186 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java @@ -30,10 +30,7 @@ public class FollowIndexIT extends ESCCRRestTestCase { " \"excludes\": [\"filtered_field\"]" + "}"; } - Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); - createIndex(leaderIndexName, indexSettings, mapping); + createIndex(leaderIndexName, Settings.EMPTY, mapping); for (int i = 0; i < numDocs; i++) { logger.info("Indexing doc [{}]", i); index(client(), leaderIndexName, Integer.toString(i), "field", i, "filtered_field", "true"); diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/XPackUsageIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/XPackUsageIT.java index b429657fe57..8d5a8d62a46 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/XPackUsageIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/XPackUsageIT.java @@ -7,8 +7,6 @@ package org.elasticsearch.xpack.ccr; import org.elasticsearch.client.Request; import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ObjectPath; import java.io.IOException; @@ -70,11 +68,8 @@ public class XPackUsageIT extends ESCCRRestTestCase { private void createLeaderIndex(String indexName) throws IOException { try (RestClient leaderClient = buildLeaderClient()) { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); Request request = new Request("PUT", "/" + indexName); - request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + "}"); + request.setJsonEntity("{}"); assertOK(leaderClient.performRequest(request)); } } diff --git a/x-pack/plugin/ccr/qa/restart/src/test/java/org/elasticsearch/xpack/ccr/RestartIT.java b/x-pack/plugin/ccr/qa/restart/src/test/java/org/elasticsearch/xpack/ccr/RestartIT.java index cbbc6945034..7422fe1b766 100644 --- a/x-pack/plugin/ccr/qa/restart/src/test/java/org/elasticsearch/xpack/ccr/RestartIT.java +++ b/x-pack/plugin/ccr/qa/restart/src/test/java/org/elasticsearch/xpack/ccr/RestartIT.java @@ -10,7 +10,6 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.RestClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexSettings; import java.io.IOException; @@ -71,9 +70,8 @@ public class RestartIT extends ESCCRRestTestCase { } private void createIndexAndIndexDocuments(final String index, final int numberOfDocuments, final RestClient client) throws IOException { - final Settings settings = Settings.builder().put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build(); final Request createIndexRequest = new Request("PUT", "/" + index); - createIndexRequest.setJsonEntity("{\"settings\":" + Strings.toString(settings) + "}"); + createIndexRequest.setJsonEntity("{\"settings\":" + Strings.toString(Settings.EMPTY) + "}"); assertOK(client.performRequest(createIndexRequest)); indexDocuments(index, numberOfDocuments, 0, client); } diff --git a/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java b/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java index f8ed48777da..7f1e4c37536 100644 --- a/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java +++ b/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java @@ -9,7 +9,6 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; @@ -53,9 +52,8 @@ public class FollowIndexSecurityIT extends ESCCRRestTestCase { final String unallowedIndex = "unallowed-index"; if ("leader".equals(targetCluster)) { logger.info("Running against leader cluster"); - Settings indexSettings = Settings.builder().put("index.soft_deletes.enabled", true).build(); - createIndex(allowedIndex, indexSettings); - createIndex(unallowedIndex, indexSettings); + createIndex(allowedIndex, Settings.EMPTY); + createIndex(unallowedIndex, Settings.EMPTY); for (int i = 0; i < numDocs; i++) { logger.info("Indexing doc [{}]", i); index(allowedIndex, Integer.toString(i), "field", i); @@ -150,11 +148,7 @@ public class FollowIndexSecurityIT extends ESCCRRestTestCase { try (RestClient leaderClient = buildLeaderClient()) { for (String index : new String[]{allowedIndex, disallowedIndex}) { - Settings settings = Settings.builder() - .put("index.soft_deletes.enabled", true) - .build(); - String requestBody = "{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"; + String requestBody = "{\"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"; request = new Request("PUT", "/" + index); request.setJsonEntity(requestBody); assertOK(leaderClient.performRequest(request)); @@ -187,11 +181,7 @@ public class FollowIndexSecurityIT extends ESCCRRestTestCase { final String forgetFollower = "forget-follower"; if ("leader".equals(targetCluster)) { logger.info("running against leader cluster"); - final Settings indexSettings = Settings.builder() - .put("index.number_of_replicas", 0) - .put("index.number_of_shards", 1) - .put("index.soft_deletes.enabled", true) - .build(); + final Settings indexSettings = Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1).build(); createIndex(forgetLeader, indexSettings); } else { logger.info("running against follower cluster"); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java index 4c306eb2195..7a0a55b7ace 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java @@ -423,6 +423,10 @@ public abstract class CcrIntegTestCase extends ESTestCase { protected boolean sourceEnabled; + protected String getIndexSettings(final int numberOfShards, final int numberOfReplicas) throws IOException { + return getIndexSettings(numberOfShards, numberOfReplicas, Collections.emptyMap()); + } + protected String getIndexSettings(final int numberOfShards, final int numberOfReplicas, final Map additionalIndexSettings) throws IOException { final String settings; diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRepositoryIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRepositoryIT.java index cf140036f60..7505d0b0046 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRepositoryIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRepositoryIT.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.support.XContentMapValues; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.repositories.Repository; import org.elasticsearch.repositories.RepositoryMissingException; @@ -48,7 +47,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static java.util.Collections.singletonMap; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -109,8 +107,7 @@ public class CcrRepositoryIT extends CcrIntegTestCase { String followerIndex = "index2"; final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen(leaderIndex); @@ -157,7 +154,6 @@ public class CcrRepositoryIT extends CcrIntegTestCase { assertEquals(leaderMetadata.getIndexUUID(), ccrMetadata.get(Ccr.CCR_CUSTOM_METADATA_LEADER_INDEX_UUID_KEY)); assertEquals("leader_cluster", ccrMetadata.get(Ccr.CCR_CUSTOM_METADATA_REMOTE_CLUSTER_NAME_KEY)); assertEquals(followerIndex, followerMetadata.getSettings().get(IndexMetaData.SETTING_INDEX_PROVIDED_NAME)); - assertEquals(true, IndexSettings.INDEX_SOFT_DELETES_SETTING.get(followerMetadata.getSettings())); // UUID is changed so that we can follow indexes on same cluster assertNotEquals(leaderMetadata.getIndexUUID(), followerMetadata.getIndexUUID()); @@ -174,8 +170,7 @@ public class CcrRepositoryIT extends CcrIntegTestCase { String followerIndex = "index2"; final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen(leaderIndex); @@ -231,8 +226,7 @@ public class CcrRepositoryIT extends CcrIntegTestCase { String followerIndex = "index2"; final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen(leaderIndex); @@ -297,8 +291,7 @@ public class CcrRepositoryIT extends CcrIntegTestCase { String followerIndex = "index2"; final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen(leaderIndex); @@ -372,8 +365,7 @@ public class CcrRepositoryIT extends CcrIntegTestCase { String followerIndex = "index2"; final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen(leaderIndex); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java index 6564ccaec63..aa50000cbd8 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java @@ -32,7 +32,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.seqno.RetentionLease; import org.elasticsearch.index.seqno.RetentionLeaseActions; import org.elasticsearch.index.seqno.RetentionLeaseNotFoundException; @@ -75,7 +74,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; -import static java.util.Collections.singletonMap; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.xpack.ccr.CcrRetentionLeases.retentionLeaseId; import static org.hamcrest.Matchers.arrayWithSize; @@ -128,7 +126,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final String leaderClusterRepoName = CcrRepository.NAME_PREFIX + "leader_cluster"; final Map additionalSettings = new HashMap<>(); - additionalSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"); additionalSettings.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); final String leaderIndexSettings = getIndexSettings(numberOfShards, numberOfReplicas, additionalSettings); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); @@ -371,8 +368,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final String leaderIndex = "leader"; final String followerIndex = "follower"; final int numberOfShards = randomIntBetween(1, 4); - final String leaderIndexSettings = - getIndexSettings(numberOfShards, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfShards, 0); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON).get()); ensureLeaderYellow(leaderIndex); final PutFollowAction.Request followRequest = putFollow(leaderIndex, followerIndex); @@ -464,8 +460,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final String leaderIndex = "leader"; final String followerIndex = "follower"; final int numberOfShards = randomIntBetween(1, 4); - final String leaderIndexSettings = - getIndexSettings(numberOfShards, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfShards, 0); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON).get()); ensureLeaderYellow(leaderIndex); final PutFollowAction.Request followRequest = putFollow(leaderIndex, followerIndex); @@ -536,7 +531,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = randomIntBetween(1, 4); final int numberOfReplicas = randomIntBetween(0, 1); final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -556,7 +550,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = randomIntBetween(1, 4); final int numberOfReplicas = randomIntBetween(0, 1); final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -620,7 +613,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = randomIntBetween(1, 4); final int numberOfReplicas = randomIntBetween(0, 1); final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -727,7 +719,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = randomIntBetween(1, 4); final int numberOfReplicas = randomIntBetween(0, 1); final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -754,7 +745,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = 1; final int numberOfReplicas = 1; final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -855,7 +845,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final int numberOfShards = 1; final int numberOfReplicas = 1; final Map additionalIndexSettings = new HashMap<>(); - additionalIndexSettings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), Boolean.toString(true)); additionalIndexSettings.put( IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200).getStringRep()); @@ -945,8 +934,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { final String leaderIndex = "leader"; final String followerIndex = "follower"; final int numberOfShards = randomIntBetween(1, 4); - final String leaderIndexSettings = - getIndexSettings(numberOfShards, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfShards, 0); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON).get()); ensureLeaderYellow(leaderIndex); final PutFollowAction.Request followRequest = putFollow(leaderIndex, followerIndex); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CloseFollowerIndexIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CloseFollowerIndexIT.java index 7f93934fd91..339b6bc3767 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CloseFollowerIndexIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CloseFollowerIndexIT.java @@ -17,7 +17,6 @@ import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.engine.ReadOnlyEngine; import org.elasticsearch.xpack.CcrIntegTestCase; import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; @@ -29,7 +28,6 @@ import java.security.PrivilegedAction; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static java.util.Collections.singletonMap; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -67,7 +65,7 @@ public class CloseFollowerIndexIT extends CcrIntegTestCase { } public void testCloseAndReopenFollowerIndex() throws Exception { - final String leaderIndexSettings = getIndexSettings(1, 1, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, 1); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java index f3cbc731de1..e5d7cf6be02 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowerFailOverIT.java @@ -21,7 +21,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.support.XContentMapValues; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; @@ -40,7 +39,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import static java.util.Collections.singletonMap; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -57,8 +55,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase { int numberOfReplicas = between(1, 2); getFollowerCluster().startMasterOnlyNode(); getFollowerCluster().ensureAtLeastNumDataNodes(numberOfReplicas + between(1, 2)); - String leaderIndexSettings = getIndexSettings(1, numberOfReplicas, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(1, numberOfReplicas); assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex).setSource(leaderIndexSettings, XContentType.JSON)); AtomicBoolean stopped = new AtomicBoolean(); Thread[] threads = new Thread[between(1, 8)]; @@ -123,7 +120,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase { public void testFollowIndexAndCloseNode() throws Exception { getFollowerCluster().ensureAtLeastNumDataNodes(3); - String leaderIndexSettings = getIndexSettings(3, 1, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(3, 1); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen("index1"); @@ -177,8 +174,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase { public void testAddNewReplicasOnFollower() throws Exception { int numberOfReplicas = between(0, 1); - String leaderIndexSettings = getIndexSettings(1, numberOfReplicas, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(1, numberOfReplicas); assertAcked(leaderClient().admin().indices().prepareCreate("leader-index").setSource(leaderIndexSettings, XContentType.JSON)); PutFollowAction.Request follow = putFollow("leader-index", "follower-index"); followerClient().execute(PutFollowAction.INSTANCE, follow).get(); @@ -245,7 +241,6 @@ public class FollowerFailOverIT extends CcrIntegTestCase { .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true") .put("index.routing.allocation.require.box", "large")) .get() ); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java index 9078245b0d1..6bfc9ace0f6 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java @@ -68,7 +68,6 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.seqno.ReplicationTracker; import org.elasticsearch.index.seqno.RetentionLeaseActions; import org.elasticsearch.index.shard.ShardId; @@ -115,7 +114,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; -import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.xpack.ccr.CcrRetentionLeases.retentionLeaseId; @@ -146,8 +144,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { new ByteSizeValue(randomIntBetween(1, 1000), ByteSizeUnit.KB))) .get(); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, numberOfReplicas, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, numberOfReplicas); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -245,8 +242,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testFollowIndexWithConcurrentMappingChanges() throws Exception { final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -314,8 +310,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testFollowIndexWithoutWaitForComplete() throws Exception { final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -356,8 +351,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testSyncMappings() throws Exception { - final String leaderIndexSettings = getIndexSettings(2, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(2, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -396,7 +390,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testNoMappingDefined() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -416,8 +409,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testDoNotAllowPutMappingToFollower() throws Exception { - final String leaderIndexSettings = getIndexSettings(between(1, 2), between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(between(1, 2), between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index-1").setSource(leaderIndexSettings, XContentType.JSON)); followerClient().execute(PutFollowAction.INSTANCE, putFollow("index-1", "index-2")).get(); PutMappingRequest putMappingRequest = new PutMappingRequest("index-2").type("doc").source("new_field", "type=keyword"); @@ -436,7 +428,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testDoNotAllowAddAliasToFollower() throws Exception { final String leaderIndexSettings = - getIndexSettings(between(1, 2), between(0, 1), singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + getIndexSettings(between(1, 2), between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(leaderIndexSettings, XContentType.JSON)); followerClient().execute(PutFollowAction.INSTANCE, putFollow("leader", "follower")).get(); final IndicesAliasesRequest request = new IndicesAliasesRequest() @@ -452,7 +444,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testAddAliasAfterUnfollow() throws Exception { final String leaderIndexSettings = - getIndexSettings(between(1, 2), between(0, 1), singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + getIndexSettings(between(1, 2), between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(leaderIndexSettings, XContentType.JSON)); followerClient().execute(PutFollowAction.INSTANCE, putFollow("leader", "follower")).get(); pauseFollow("follower"); @@ -473,8 +465,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testFollowIndex_backlog() throws Exception { int numberOfShards = between(1, 5); - String leaderIndexSettings = getIndexSettings(numberOfShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(numberOfShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); BulkProcessor.Listener listener = new BulkProcessor.Listener() { @Override @@ -537,8 +528,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testFollowIndexWithNestedField() throws Exception { - final String leaderIndexSettings = - getIndexSettingsWithNestedMapping(1, between(0, 1), singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettingsWithNestedMapping(1, between(0, 1), Collections.emptyMap()); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen("index1"); @@ -583,7 +573,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testFollowNonExistentIndex() throws Exception { - String indexSettings = getIndexSettings(1, 0, Collections.emptyMap()); + String indexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("test-leader").setSource(indexSettings, XContentType.JSON).get()); assertAcked(followerClient().admin().indices().prepareCreate("test-follower").setSource(indexSettings, XContentType.JSON).get()); ensureLeaderGreen("test-leader"); @@ -604,8 +594,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testFollowIndexMaxOperationSizeInBytes() throws Exception { - final String leaderIndexSettings = getIndexSettings(1, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -639,7 +628,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testAttemptToChangeCcrFollowingIndexSetting() throws Exception { - String leaderIndexSettings = getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON).get()); ensureLeaderYellow("index1"); PutFollowAction.Request followRequest = putFollow("index1", "index2"); @@ -658,7 +647,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testCloseLeaderIndex() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -692,7 +680,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testCloseFollowIndex() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -721,7 +708,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testDeleteLeaderIndex() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -749,10 +735,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testFollowClosedIndex() { final String leaderIndex = "test-index"; - assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex) - .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) - .build())); + assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex)); assertAcked(leaderClient().admin().indices().prepareClose(leaderIndex)); final String followerIndex = "follow-test-index"; @@ -765,7 +748,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { final String leaderIndex = "test-index"; assertAcked(leaderClient().admin().indices().prepareCreate(leaderIndex) .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -791,7 +773,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testDeleteFollowerIndex() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -822,7 +803,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testPauseIndex() throws Exception { assertAcked(leaderClient().admin().indices().prepareCreate("leader") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -841,7 +821,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testUnfollowIndex() throws Exception { - String leaderIndexSettings = getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON).get()); PutFollowAction.Request followRequest = putFollow("index1", "index2"); followerClient().execute(PutFollowAction.INSTANCE, followRequest).get(); @@ -868,8 +848,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testUnknownClusterAlias() throws Exception { - String leaderIndexSettings = getIndexSettings(1, 0, - Collections.singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen("index1"); PutFollowAction.Request followRequest = putFollow("index1", "index2"); @@ -894,7 +873,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setWaitForActiveShards(ActiveShardCount.NONE) .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build())); @@ -916,8 +894,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testUpdateDynamicLeaderIndexSettings() throws Exception { - final String leaderIndexSettings = getIndexSettings(1, 0, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("leader"); @@ -970,8 +947,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { // Sets an index setting on leader index that is excluded from being replicated to the follower index and // expects that this setting is not replicated to the follower index, but does expect that the settings version // is incremented. - final String leaderIndexSettings = getIndexSettings(1, 0, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("leader"); @@ -1020,8 +996,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testUpdateAnalysisLeaderIndexSettings() throws Exception { - final String leaderIndexSettings = getIndexSettings(1, 0, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("leader"); @@ -1093,8 +1068,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testDoNotReplicatePrivateSettings() throws Exception { - assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource( - getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")), XContentType.JSON)); + assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(getIndexSettings(1, 0), XContentType.JSON)); ensureLeaderGreen("leader"); final PutFollowAction.Request followRequest = putFollow("leader", "follower"); followerClient().execute(PutFollowAction.INSTANCE, followRequest).get(); @@ -1133,8 +1107,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { } public void testReplicatePrivateSettingsOnly() throws Exception { - assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource( - getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")), XContentType.JSON)); + assertAcked(leaderClient().admin().indices().prepareCreate("leader").setSource(getIndexSettings(1, 0), XContentType.JSON)); ensureLeaderGreen("leader"); followerClient().execute(PutFollowAction.INSTANCE, putFollow("leader", "follower")).get(); final ClusterService clusterService = getLeaderCluster().getInstance(ClusterService.class, getLeaderCluster().getMasterName()); @@ -1174,8 +1147,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { public void testMustCloseIndexAndPauseToRestartWithPutFollowing() throws Exception { final int numberOfPrimaryShards = randomIntBetween(1, 3); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1)); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -1258,7 +1230,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { final Consumer> exceptionConsumer) throws Exception { final int numberOfPrimaryShards = randomIntBetween(1, 3); final Map extraSettingsMap = new HashMap<>(2); - extraSettingsMap.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"); extraSettingsMap.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "200ms"); final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, between(0, 1), extraSettingsMap); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); @@ -1341,8 +1312,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { final int numberOfPrimaryShards = randomIntBetween(1, 3); int numberOfReplicas = between(0, 1); - final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, numberOfReplicas, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(numberOfPrimaryShards, numberOfReplicas); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderYellow("index1"); @@ -1404,7 +1374,6 @@ public class IndexFollowingIT extends CcrIntegTestCase { final int numberOfShards = randomIntBetween(1, 10); assertAcked(leaderClient().admin().indices().prepareCreate("index1") .setSettings(Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numberOfShards) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 1)) .build())); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/RestartIndexFollowingIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/RestartIndexFollowingIT.java index 87b5ef49eab..75dcac2a716 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/RestartIndexFollowingIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/RestartIndexFollowingIT.java @@ -11,7 +11,6 @@ import org.elasticsearch.action.admin.cluster.remote.RemoteInfoRequest; import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.transport.RemoteConnectionInfo; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.CcrIntegTestCase; @@ -20,7 +19,6 @@ import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import java.util.List; import java.util.Locale; -import static java.util.Collections.singletonMap; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -37,8 +35,7 @@ public class RestartIndexFollowingIT extends CcrIntegTestCase { } public void testFollowIndex() throws Exception { - final String leaderIndexSettings = getIndexSettings(1, 0, - singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); + final String leaderIndexSettings = getIndexSettings(1, 0); assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); ensureLeaderGreen("index1"); setupRemoteCluster(); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java index ba2afd788f6..dc30fe506a2 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java @@ -618,7 +618,7 @@ public class AutoFollowCoordinatorTests extends ESTestCase { ClusterState remoteState = createRemoteClusterState("index1", true); MetaData.Builder mBuilder= MetaData.builder(remoteState.metaData()); mBuilder.put(IndexMetaData.builder("index2") - .settings(settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)) + .settings(settings(Version.CURRENT)) .numberOfShards(1) .numberOfReplicas(0)); ShardRouting shardRouting = @@ -707,13 +707,11 @@ public class AutoFollowCoordinatorTests extends ESTestCase { MetaData remoteMetadata = new MetaData.Builder() .put(IndexMetaData.builder("index1") .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, "index1")) .numberOfShards(1) .numberOfReplicas(0)) .put(IndexMetaData.builder("index3") .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, "index3")) .numberOfShards(1) .numberOfReplicas(0)) @@ -736,19 +734,16 @@ public class AutoFollowCoordinatorTests extends ESTestCase { MetaData remoteMetadata = new MetaData.Builder() .put(IndexMetaData.builder("index1") .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, "index1")) .numberOfShards(1) .numberOfReplicas(0)) .put(IndexMetaData.builder("index2") .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, "index2")) .numberOfShards(1) .numberOfReplicas(0)) .put(IndexMetaData.builder("index3") .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, "index3")) .numberOfShards(1) .numberOfReplicas(0)) @@ -768,7 +763,7 @@ public class AutoFollowCoordinatorTests extends ESTestCase { MetaData remoteMetadata = new MetaData.Builder() .put(IndexMetaData.builder("index1") - .settings(settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)) + .settings(settings(Version.CURRENT)) .numberOfShards(1) .numberOfReplicas(0)) .build(); @@ -1253,7 +1248,7 @@ public class AutoFollowCoordinatorTests extends ESTestCase { ClusterState currentState = ClusterState.builder(new ClusterName("name")) .metaData(MetaData.builder() .put(IndexMetaData.builder("logs-20190101") - .settings(settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)) + .settings(settings(Version.CURRENT)) .putCustom(Ccr.CCR_CUSTOM_METADATA_KEY, Collections.singletonMap(Ccr.CCR_CUSTOM_METADATA_LEADER_INDEX_UUID_KEY, remoteState.metaData().index("logs-20190101").getIndexUUID())) .numberOfShards(1) @@ -1513,7 +1508,6 @@ public class AutoFollowCoordinatorTests extends ESTestCase { for (String indexName : indices) { IndexMetaData indexMetaData = IndexMetaData.builder(indexName) .settings(settings(Version.CURRENT) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexMetaData.SETTING_INDEX_UUID, UUIDs.randomBase64UUID(random()))) .numberOfShards(1) .numberOfReplicas(0) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/TransportResumeFollowActionTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/TransportResumeFollowActionTests.java index 3751cc6ba58..a13b806e670 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/TransportResumeFollowActionTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/TransportResumeFollowActionTests.java @@ -108,8 +108,7 @@ public class TransportResumeFollowActionTests extends ESTestCase { } { // should fail, because leader index is closed - IndexMetaData leaderIMD = createIMD("index1", State.CLOSE, "{}", 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true").build(), null); + IndexMetaData leaderIMD = createIMD("index1", State.CLOSE, "{}", 5, Settings.EMPTY, null); IndexMetaData followIMD = createIMD("index2", State.OPEN, "{}", 5, Settings.EMPTY, customMetaData); Exception e = expectThrows(IllegalArgumentException.class, () -> validate(request, leaderIMD, followIMD, UUIDs, null)); assertThat(e.getMessage(), equalTo("leader and follow index must be open")); @@ -128,10 +127,9 @@ public class TransportResumeFollowActionTests extends ESTestCase { { // should fail, because leader has a field with the same name mapped as keyword and follower as text IndexMetaData leaderIMD = createIMD("index1", State.OPEN, "{\"properties\": {\"field\": {\"type\": \"keyword\"}}}", 5, - Settings.builder().put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true").build(), null); + Settings.EMPTY, null); IndexMetaData followIMD = createIMD("index2", State.OPEN, "{\"properties\": {\"field\": {\"type\": \"text\"}}}", 5, - Settings.builder().put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build(), customMetaData); + Settings.builder().put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true).build(), customMetaData); MapperService mapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), Settings.EMPTY, "index2"); mapperService.updateMapping(null, followIMD); Exception e = expectThrows(IllegalArgumentException.class, () -> validate(request, leaderIMD, followIMD, UUIDs, mapperService)); @@ -141,12 +139,10 @@ public class TransportResumeFollowActionTests extends ESTestCase { // should fail because of non whitelisted settings not the same between leader and follow index String mapping = "{\"properties\": {\"field\": {\"type\": \"text\", \"analyzer\": \"my_analyzer\"}}}"; IndexMetaData leaderIMD = createIMD("index1", State.OPEN, mapping, 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true") .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "whitespace").build(), null); IndexMetaData followIMD = createIMD("index2", State.OPEN, mapping, 5, Settings.builder() .put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard").build(), customMetaData); Exception e = expectThrows(IllegalArgumentException.class, () -> validate(request, leaderIMD, followIMD, UUIDs, null)); @@ -157,10 +153,8 @@ public class TransportResumeFollowActionTests extends ESTestCase { } { // should fail because the following index does not have the following_index settings - IndexMetaData leaderIMD = createIMD("index1", 5, - Settings.builder().put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true").build(), null); - Settings followingIndexSettings = Settings.builder().put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) - .put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), false).build(); + IndexMetaData leaderIMD = createIMD("index1", 5, Settings.EMPTY, null); + Settings followingIndexSettings = Settings.builder().put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), false).build(); IndexMetaData followIMD = createIMD("index2", 5, followingIndexSettings, customMetaData); MapperService mapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), followingIndexSettings, "index2"); @@ -172,10 +166,8 @@ public class TransportResumeFollowActionTests extends ESTestCase { } { // should succeed - IndexMetaData leaderIMD = createIMD("index1", 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true").build(), null); + IndexMetaData leaderIMD = createIMD("index1", 5, Settings.EMPTY, null); IndexMetaData followIMD = createIMD("index2", 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true).build(), customMetaData); MapperService mapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), Settings.EMPTY, "index2"); mapperService.updateMapping(null, followIMD); @@ -185,12 +177,10 @@ public class TransportResumeFollowActionTests extends ESTestCase { // should succeed, index settings are identical String mapping = "{\"properties\": {\"field\": {\"type\": \"text\", \"analyzer\": \"my_analyzer\"}}}"; IndexMetaData leaderIMD = createIMD("index1", State.OPEN, mapping, 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true") .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard").build(), null); IndexMetaData followIMD = createIMD("index2", State.OPEN, mapping, 5, Settings.builder() .put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard").build(), customMetaData); MapperService mapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), @@ -202,13 +192,11 @@ public class TransportResumeFollowActionTests extends ESTestCase { // should succeed despite whitelisted settings being different String mapping = "{\"properties\": {\"field\": {\"type\": \"text\", \"analyzer\": \"my_analyzer\"}}}"; IndexMetaData leaderIMD = createIMD("index1", State.OPEN, mapping, 5, Settings.builder() - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true") .put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "1s") .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard").build(), null); IndexMetaData followIMD = createIMD("index2", State.OPEN, mapping, 5, Settings.builder() .put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) .put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "10s") .put("index.analysis.analyzer.my_analyzer.type", "custom") .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard").build(), customMetaData); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowingEngineTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowingEngineTests.java index c164c1e9111..01089c13a76 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowingEngineTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowingEngineTests.java @@ -131,7 +131,6 @@ public class FollowingEngineTests extends ESTestCase { .put("index.number_of_replicas", 0) .put("index.version.created", Version.CURRENT) .put("index.xpack.ccr.following_index", true) - .put("index.soft_deletes.enabled", true) .build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); @@ -157,7 +156,6 @@ public class FollowingEngineTests extends ESTestCase { .put("index.number_of_replicas", 0) .put("index.version.created", Version.CURRENT) .put("index.xpack.ccr.following_index", true) - .put("index.soft_deletes.enabled", true) .build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); @@ -192,7 +190,6 @@ public class FollowingEngineTests extends ESTestCase { .put("index.number_of_replicas", 0) .put("index.version.created", Version.CURRENT) .put("index.xpack.ccr.following_index", true) - .put("index.soft_deletes.enabled", true) .build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); @@ -224,7 +221,6 @@ public class FollowingEngineTests extends ESTestCase { .put("index.number_of_replicas", 0) .put("index.version.created", Version.CURRENT) .put("index.xpack.ccr.following_index", true) - .put("index.soft_deletes.enabled", true) .build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); @@ -493,7 +489,7 @@ public class FollowingEngineTests extends ESTestCase { Settings leaderSettings = Settings.builder() .put("index.number_of_shards", 1).put("index.number_of_replicas", 0) - .put("index.version.created", Version.CURRENT).put("index.soft_deletes.enabled", true).build(); + .put("index.version.created", Version.CURRENT).build(); IndexMetaData leaderIndexMetaData = IndexMetaData.builder(index.getName()).settings(leaderSettings).build(); IndexSettings leaderIndexSettings = new IndexSettings(leaderIndexMetaData, leaderSettings); try (Store leaderStore = createStore(shardId, leaderIndexSettings, newDirectory())) { @@ -579,8 +575,7 @@ public class FollowingEngineTests extends ESTestCase { public void testProcessOnceOnPrimary() throws Exception { final Settings settings = Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0) - .put("index.version.created", Version.CURRENT).put("index.xpack.ccr.following_index", true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build(); + .put("index.version.created", Version.CURRENT).put("index.xpack.ccr.following_index", true).build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); final CheckedBiFunction nestedDocFunc = EngineTestCase.nestedParsedDocFactory(); @@ -674,8 +669,7 @@ public class FollowingEngineTests extends ESTestCase { public void testMaxSeqNoInCommitUserData() throws Exception { final Settings settings = Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0) - .put("index.version.created", Version.CURRENT).put("index.xpack.ccr.following_index", true) - .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build(); + .put("index.version.created", Version.CURRENT).put("index.xpack.ccr.following_index", true).build(); final IndexMetaData indexMetaData = IndexMetaData.builder(index.getName()).settings(settings).build(); final IndexSettings indexSettings = new IndexSettings(indexMetaData, settings); try (Store store = createStore(shardId, indexSettings, newDirectory())) { diff --git a/x-pack/plugin/ilm/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ilm/CCRIndexLifecycleIT.java b/x-pack/plugin/ilm/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ilm/CCRIndexLifecycleIT.java index a887ccd3c98..24123735091 100644 --- a/x-pack/plugin/ilm/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ilm/CCRIndexLifecycleIT.java +++ b/x-pack/plugin/ilm/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ilm/CCRIndexLifecycleIT.java @@ -55,7 +55,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { if ("leader".equals(targetCluster)) { putILMPolicy(policyName, "50GB", null, TimeValue.timeValueHours(7*24)); Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.lifecycle.name", policyName) @@ -114,7 +113,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { String indexName = "unfollow-test-index"; if ("leader".equals(targetCluster)) { Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 2) .put("index.number_of_replicas", 0) .build(); @@ -193,7 +191,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { putILMPolicy(policyName, null, 1, null); Request templateRequest = new Request("PUT", "_template/my_template"); Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.lifecycle.name", policyName) @@ -293,7 +290,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { if ("leader".equals(targetCluster)) { Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 3) .put("index.number_of_replicas", 0) .put("index.lifecycle.name", policyName) // this policy won't exist on the leader, that's fine @@ -359,7 +355,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { if ("leader".equals(targetCluster)) { Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 3) .put("index.number_of_replicas", 0) .put("index.lifecycle.name", policyName) // this policy won't exist on the leader, that's fine @@ -411,7 +406,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { // follower putShrinkOnlyPolicy(client(), policyName); Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 2) .put("index.number_of_replicas", 0) .build(); @@ -484,7 +478,6 @@ public class CCRIndexLifecycleIT extends ESCCRRestTestCase { if ("leader".equals(targetCluster)) { Settings indexSettings = Settings.builder() - .put("index.soft_deletes.enabled", true) .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.lifecycle.name", policyName) // this policy won't exist on the leader, that's fine