We no longer need to explicitly enable soft-deletes in CCR tests. Relates #50775 Backport of #51113
This commit is contained in:
parent
93f60f4c01
commit
072203cba8
|
@ -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));
|
||||
|
||||
|
|
|
@ -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<String, String> 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));
|
||||
}
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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<String, String> additionalIndexSettings) throws IOException {
|
||||
final String settings;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
|
|
|
@ -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<Collection<ResourceNotFoundException>> exceptionConsumer) throws Exception {
|
||||
final int numberOfPrimaryShards = randomIntBetween(1, 3);
|
||||
final Map<String, String> 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()));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String, Integer, ParsedDocument, IOException> 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())) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue