mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 09:28:27 +00:00
This change deprecates the translog retention settings as they are effectively ignored since 7.4. Relates #50775 Relates #45473
This commit is contained in:
parent
1064009e9d
commit
f0fad5b622
@ -80,6 +80,10 @@ update, or bulk request. This setting accepts the following parameters:
|
||||
[[index-modules-translog-retention]]
|
||||
==== Translog retention
|
||||
|
||||
deprecated::[7.4.0, translog retention settings are deprecated in favor of
|
||||
<<index-modules-history-retention,soft deletes>>. These settings are
|
||||
effectively ignored since 7.4 and will be removed in a future version].
|
||||
|
||||
If an index is not using <<index-modules-history-retention,soft deletes>> to
|
||||
retain historical operations then {es} recovers each replica shard by replaying
|
||||
operations from the primary's translog. This means it is important for the
|
||||
|
@ -121,6 +121,41 @@
|
||||
- lt: { indices.test.primaries.translog.uncommitted_size_in_bytes: $creation_size }
|
||||
- match: { indices.test.primaries.translog.uncommitted_operations: 0 }
|
||||
|
||||
---
|
||||
"Translog retention settings are deprecated":
|
||||
- skip:
|
||||
version: " - 7.6.99"
|
||||
reason: "translog retention settings are deprecated in 7.6"
|
||||
features: "warnings"
|
||||
- do:
|
||||
warnings:
|
||||
- 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.
|
||||
indices.create:
|
||||
index: test
|
||||
body:
|
||||
settings:
|
||||
index.translog.retention.size: 128mb
|
||||
- do:
|
||||
indices.put_settings:
|
||||
index: test
|
||||
body:
|
||||
index.number_of_replicas: 0
|
||||
- do:
|
||||
warnings:
|
||||
- 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.
|
||||
indices.put_settings:
|
||||
index: test
|
||||
body:
|
||||
index.translog.retention.age: 1h
|
||||
- do:
|
||||
indices.put_settings:
|
||||
index: test
|
||||
body:
|
||||
index.translog.retention.age: null
|
||||
index.translog.retention.size: null
|
||||
|
||||
---
|
||||
"Translog last modified age stats":
|
||||
- skip:
|
||||
|
@ -493,6 +493,7 @@ public class MetaDataCreateIndexService {
|
||||
"Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. " +
|
||||
"Please do not specify value for setting [index.soft_deletes.enabled] of index [" + request.index() + "].");
|
||||
}
|
||||
validateTranslogRetentionSettings(indexSettings);
|
||||
return indexSettings;
|
||||
}
|
||||
|
||||
@ -975,4 +976,13 @@ public class MetaDataCreateIndexService {
|
||||
return numShards;
|
||||
}
|
||||
}
|
||||
|
||||
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.deprecatedAndMaybeLog("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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
||||
@ -214,6 +215,12 @@ public class MetaDataUpdateSettingsService {
|
||||
}
|
||||
}
|
||||
|
||||
if (IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(normalizedSettings) ||
|
||||
IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(normalizedSettings)) {
|
||||
for (String index : actualIndices) {
|
||||
MetaDataCreateIndexService.validateTranslogRetentionSettings(metaDataBuilder.get(index).getSettings());
|
||||
}
|
||||
}
|
||||
// increment settings versions
|
||||
for (final String index : actualIndices) {
|
||||
if (same(currentState.metaData().index(index).getSettings(), metaDataBuilder.get(index).getSettings()) == false) {
|
||||
|
@ -46,6 +46,7 @@ import org.elasticsearch.common.compress.CompressedXContent;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
@ -946,6 +947,21 @@ public class MetaDataCreateIndexServiceTests extends ESTestCase {
|
||||
null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
|
||||
}
|
||||
|
||||
public void testValidateTranslogRetentionSettings() {
|
||||
request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test");
|
||||
final Settings.Builder settings = Settings.builder();
|
||||
if (randomBoolean()) {
|
||||
settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.getKey(), TimeValue.timeValueMillis(between(1, 120)));
|
||||
} else {
|
||||
settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.getKey(), between(1, 128) + "mb");
|
||||
}
|
||||
request.settings(settings.build());
|
||||
aggregateIndexSettings(ClusterState.EMPTY_STATE, request, Collections.emptyList(), Collections.emptyMap(),
|
||||
null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
|
||||
assertWarnings("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.");
|
||||
}
|
||||
|
||||
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