Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate unused index.ttl.disable_purge setting #29526

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions server/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public final class IndexSettings {
(value) -> Translog.Durability.valueOf(value.toUpperCase(Locale.ROOT)), Property.Dynamic, Property.IndexScope);
public static final Setting<Boolean> INDEX_WARMER_ENABLED_SETTING =
Setting.boolSetting("index.warmer.enabled", true, Property.Dynamic, Property.IndexScope);
@Deprecated
public static final Setting<Boolean> INDEX_TTL_DISABLE_PURGE_SETTING =
Setting.boolSetting("index.ttl.disable_purge", false, Property.Dynamic, Property.IndexScope);
Setting.boolSetting("index.ttl.disable_purge", false, Property.Dynamic, Property.IndexScope, Property.Deprecated);
public static final Setting<String> INDEX_CHECK_ON_STARTUP = new Setting<>("index.shard.check_on_startup", "false", (s) -> {
switch(s) {
case "false":
Expand Down Expand Up @@ -302,7 +303,6 @@ public final class IndexSettings {
private volatile int maxScriptFields;
private volatile int maxNgramDiff;
private volatile int maxShingleDiff;
private volatile boolean TTLPurgeDisabled;
private volatile int maxAnalyzedOffset;
private volatile int maxTermsCount;

Expand Down Expand Up @@ -410,7 +410,6 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
maxScriptFields = scopedSettings.get(MAX_SCRIPT_FIELDS_SETTING);
maxNgramDiff = scopedSettings.get(MAX_NGRAM_DIFF_SETTING);
maxShingleDiff = scopedSettings.get(MAX_SHINGLE_DIFF_SETTING);
TTLPurgeDisabled = scopedSettings.get(INDEX_TTL_DISABLE_PURGE_SETTING);
maxRefreshListeners = scopedSettings.get(MAX_REFRESH_LISTENERS_PER_SHARD);
maxSlicesPerScroll = scopedSettings.get(MAX_SLICES_PER_SCROLL);
maxAnalyzedOffset = scopedSettings.get(MAX_ANALYZED_OFFSET_SETTING);
Expand All @@ -436,7 +435,6 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
mergeSchedulerConfig::setMaxThreadAndMergeCount);
scopedSettings.addSettingsUpdateConsumer(MergeSchedulerConfig.AUTO_THROTTLE_SETTING, mergeSchedulerConfig::setAutoThrottle);
scopedSettings.addSettingsUpdateConsumer(INDEX_TRANSLOG_DURABILITY_SETTING, this::setTranslogDurability);
scopedSettings.addSettingsUpdateConsumer(INDEX_TTL_DISABLE_PURGE_SETTING, this::setTTLPurgeDisabled);
scopedSettings.addSettingsUpdateConsumer(MAX_RESULT_WINDOW_SETTING, this::setMaxResultWindow);
scopedSettings.addSettingsUpdateConsumer(MAX_INNER_RESULT_WINDOW_SETTING, this::setMaxInnerResultWindow);
scopedSettings.addSettingsUpdateConsumer(MAX_ADJACENCY_MATRIX_FILTERS_SETTING, this::setMaxAdjacencyMatrixFilters);
Expand Down Expand Up @@ -774,18 +772,6 @@ public MergePolicy getMergePolicy() {
return mergePolicyConfig.getMergePolicy();
}

/**
* Returns <code>true</code> if the TTL purge is disabled for this index. Default is <code>false</code>
*/
public boolean isTTLPurgeDisabled() {
return TTLPurgeDisabled;
}

private void setTTLPurgeDisabled(boolean ttlPurgeDisabled) {
this.TTLPurgeDisabled = ttlPurgeDisabled;
}


public <T> T getValue(Setting<T> setting) {
return scopedSettings.get(setting);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,24 +386,12 @@ public void testGCDeletesSetting() {
}

public void testIsTTLPurgeDisabled() {
IndexMetaData metaData = newIndexMeta("index", Settings.builder()
final Settings settings = Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING.getKey(), false)
.build());
IndexSettings settings = new IndexSettings(metaData, Settings.EMPTY);
assertFalse(settings.isTTLPurgeDisabled());
settings.updateIndexMetaData(newIndexMeta("index", Settings.builder().put(IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING.getKey(),
"true").build()));
assertTrue(settings.isTTLPurgeDisabled());

settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY));
assertFalse("reset to default", settings.isTTLPurgeDisabled());

metaData = newIndexMeta("index", Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.build());
settings = new IndexSettings(metaData, Settings.EMPTY);
assertFalse(settings.isTTLPurgeDisabled());
.put(IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING.getKey(), true)
.build();
assertTrue(IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING.get(settings));
assertSettingDeprecationsAndWarnings(new Setting<?>[]{IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING});
}

public void testTranslogFlushSizeThreshold() {
Expand Down