Skip to content

Commit 08e887a

Browse files
authored
Set default SLM retention invocation time (#47604)
This adds a default for the `slm.retention_schedule` setting, setting it to `0 30 1 * * ?` which is 1:30am every day. Having retention unset meant that it would never be invoked and clean up snapshots. We determined it would be better to have a default than never to be run. When coming to a decision, we weighed the option of an absolute time (such as 1:30am) versus a periodic invocation (like every 12 hours). In the end we decided on the absolute time because it has better predictability and consistency than a periodic invocation, which would rely on when the master node were elected or restarted. Relates to #43663
1 parent f6f249b commit 08e887a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

server/src/main/java/org/elasticsearch/common/settings/Setting.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,11 @@ public static Setting<String> simpleString(String key, Validator<String> validat
10731073
return new Setting<>(new SimpleKey(key), null, s -> "", Function.identity(), validator, properties);
10741074
}
10751075

1076+
public static Setting<String> simpleString(String key, String defaultValue, Validator<String> validator, Property... properties) {
1077+
validator.validate(defaultValue);
1078+
return new Setting<>(new SimpleKey(key), null, s -> defaultValue, Function.identity(), validator, properties);
1079+
}
1080+
10761081
public static Setting<String> simpleString(String key, Setting<String> fallback, Property... properties) {
10771082
return simpleString(key, fallback, Function.identity(), properties);
10781083
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public class LifecycleSettings {
3838

3939
public static final Setting<Boolean> SLM_HISTORY_INDEX_ENABLED_SETTING = Setting.boolSetting(SLM_HISTORY_INDEX_ENABLED, true,
4040
Setting.Property.NodeScope);
41-
public static final Setting<String> SLM_RETENTION_SCHEDULE_SETTING = Setting.simpleString(SLM_RETENTION_SCHEDULE, str -> {
41+
public static final Setting<String> SLM_RETENTION_SCHEDULE_SETTING = Setting.simpleString(SLM_RETENTION_SCHEDULE,
42+
// Default to 1:30am every day
43+
"0 30 1 * * ?",
44+
str -> {
4245
try {
4346
if (Strings.hasText(str)) {
4447
// Test that the setting is a valid cron syntax

0 commit comments

Comments
 (0)