Skip to content

Commit

Permalink
Set default SLM retention invocation time (#47604)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dakrone authored Oct 4, 2019
1 parent f6f249b commit 08e887a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,11 @@ public static Setting<String> simpleString(String key, Validator<String> validat
return new Setting<>(new SimpleKey(key), null, s -> "", Function.identity(), validator, properties);
}

public static Setting<String> simpleString(String key, String defaultValue, Validator<String> validator, Property... properties) {
validator.validate(defaultValue);
return new Setting<>(new SimpleKey(key), null, s -> defaultValue, Function.identity(), validator, properties);
}

public static Setting<String> simpleString(String key, Setting<String> fallback, Property... properties) {
return simpleString(key, fallback, Function.identity(), properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public class LifecycleSettings {

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

0 comments on commit 08e887a

Please sign in to comment.