mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-16 18:04:52 +00:00
[Tests] Translog Pruning tests to MetadataCreateIndexServiceTests (#1295)
This commit adds test coverage for translog pruning setting to MetadataCreateIndexServiceTests Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
parent
29c88c6900
commit
46e0f63539
@ -1258,11 +1258,19 @@ public class MetadataCreateIndexService {
|
||||
}
|
||||
|
||||
public static void validateTranslogRetentionSettings(Settings indexSettings) {
|
||||
if (IndexSettings.INDEX_SOFT_DELETES_SETTING.get(indexSettings) &&
|
||||
(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(indexSettings)
|
||||
|| IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(indexSettings))) {
|
||||
DEPRECATION_LOGGER.deprecate("translog_retention", "Translog retention settings [index.translog.retention.age] "
|
||||
+ "and [index.translog.retention.size] are deprecated and effectively ignored. They will be removed in a future version.");
|
||||
if (IndexSettings.INDEX_SOFT_DELETES_SETTING.get(indexSettings)) {
|
||||
if(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(indexSettings)
|
||||
|| IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(indexSettings)) {
|
||||
DEPRECATION_LOGGER.deprecate("translog_retention", "Translog retention settings " +
|
||||
"[index.translog.retention.age] "
|
||||
+ "and [index.translog.retention.size] are deprecated and effectively ignored. " +
|
||||
"They will be removed in a future version.");
|
||||
} else if(IndexSettings.INDEX_PLUGINS_REPLICATION_TRANSLOG_RETENTION_LEASE_PRUNING_ENABLED_SETTING.exists(indexSettings)) {
|
||||
DEPRECATION_LOGGER.deprecate("translog_pruning_retention_lease",
|
||||
"[index.plugins.replication.translog.retention_lease.pruning.enabled] " +
|
||||
"setting was deprecated in OpenSearch and will be removed in a future release! " +
|
||||
"See the breaking changes documentation for the next major version.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1001,6 +1001,19 @@ public class MetadataCreateIndexServiceTests extends OpenSearchTestCase {
|
||||
"or better performance, or other file systems instead.");
|
||||
}
|
||||
|
||||
public void testTranslogPruningBasedOnRetentionLeaseDeprecation() {
|
||||
request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test");
|
||||
request.settings(Settings.builder()
|
||||
.put(INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
.put(IndexSettings.INDEX_PLUGINS_REPLICATION_TRANSLOG_RETENTION_LEASE_PRUNING_ENABLED_SETTING.getKey(), true).build());
|
||||
aggregateIndexSettings(ClusterState.EMPTY_STATE, request, Settings.EMPTY,
|
||||
null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, randomShardLimitService(),
|
||||
Collections.emptySet());
|
||||
assertWarnings("[index.plugins.replication.translog.retention_lease.pruning.enabled] setting " +
|
||||
"was deprecated in OpenSearch and will be removed in a future release! " +
|
||||
"See the breaking changes documentation for the next major version.");
|
||||
}
|
||||
|
||||
private IndexTemplateMetadata addMatchingTemplate(Consumer<IndexTemplateMetadata.Builder> configurator) {
|
||||
IndexTemplateMetadata.Builder builder = templateMetadataBuilder("template1", "te*");
|
||||
configurator.accept(builder);
|
||||
|
Loading…
x
Reference in New Issue
Block a user