|
46 | 46 | import org.elasticsearch.common.settings.IndexScopedSettings;
|
47 | 47 | import org.elasticsearch.common.settings.Setting;
|
48 | 48 | import org.elasticsearch.common.settings.Settings;
|
| 49 | +import org.elasticsearch.common.unit.TimeValue; |
49 | 50 | import org.elasticsearch.common.util.BigArrays;
|
50 | 51 | import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
51 | 52 | import org.elasticsearch.common.xcontent.XContentFactory;
|
@@ -910,6 +911,21 @@ public void testRejectWithSoftDeletesDisabled() {
|
910 | 911 | + "Please do not specify a value for setting [index.soft_deletes.enabled]."));
|
911 | 912 | }
|
912 | 913 |
|
| 914 | + public void testValidateTranslogRetentionSettings() { |
| 915 | + request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test"); |
| 916 | + final Settings.Builder settings = Settings.builder(); |
| 917 | + if (randomBoolean()) { |
| 918 | + settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.getKey(), TimeValue.timeValueMillis(between(1, 120))); |
| 919 | + } else { |
| 920 | + settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.getKey(), between(1, 128) + "mb"); |
| 921 | + } |
| 922 | + request.settings(settings.build()); |
| 923 | + aggregateIndexSettings(ClusterState.EMPTY_STATE, request, List.of(), Map.of(), |
| 924 | + null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS); |
| 925 | + assertWarnings("Translog retention settings [index.translog.retention.age] " |
| 926 | + + "and [index.translog.retention.size] are deprecated and effectively ignored. They will be removed in a future version."); |
| 927 | + } |
| 928 | + |
913 | 929 | private IndexTemplateMetaData addMatchingTemplate(Consumer<IndexTemplateMetaData.Builder> configurator) {
|
914 | 930 | IndexTemplateMetaData.Builder builder = templateMetaDataBuilder("template1", "te*");
|
915 | 931 | configurator.accept(builder);
|
|
0 commit comments