Skip to content

Commit 6c93c29

Browse files
talevyjasontedor
authored andcommitted
change default indices.lifecycle.poll_interval to something sane (#32521)
This was originally set to a few seconds while prototyping things. This interval is for the scheduled trigger of policies. Policies have this extra trigger beyond just on cluster-state changes because cluster-state changes may not be happeneing in a cluster for whatever reason, and we need to continue making progress. Updating this value to be larger is reasonable since not all operations are expected to be completed in the span of seconds, but instead in minutes and hours. 10 minutes is sane.
1 parent 6bf89c8 commit 6c93c29

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ public class LifecycleSettings {
2525
public static final String LIFECYCLE_STEP_INFO = "index.lifecycle.step_info";
2626
public static final String LIFECYCLE_SKIP = "index.lifecycle.skip";
2727

28-
// NORELEASE: we should probably change the default to something other than three seconds for initial release
2928
public static final Setting<TimeValue> LIFECYCLE_POLL_INTERVAL_SETTING = Setting.positiveTimeSetting(LIFECYCLE_POLL_INTERVAL,
30-
TimeValue.timeValueSeconds(3), Setting.Property.Dynamic, Setting.Property.NodeScope);
29+
TimeValue.timeValueMinutes(10), Setting.Property.Dynamic, Setting.Property.NodeScope);
3130
public static final Setting<String> LIFECYCLE_NAME_SETTING = Setting.simpleString(LIFECYCLE_NAME,
3231
Setting.Property.Dynamic, Setting.Property.IndexScope, Setting.Property.InternalIndex);
3332
public static final Setting<String> LIFECYCLE_PHASE_SETTING = Setting.simpleString(LIFECYCLE_PHASE,

x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public void testSchedulerInitializationAndUpdate() {
261261
indexLifecycleService.clusterChanged(noChangeEvent);
262262
assertThat(indexLifecycleService.getScheduler().jobCount(), equalTo(1));
263263
assertThat(((TimeValueSchedule) indexLifecycleService.getScheduledJob().getSchedule()).getInterval(),
264-
equalTo(TimeValue.timeValueSeconds(3)));
264+
equalTo(LifecycleSettings.LIFECYCLE_POLL_INTERVAL_SETTING.getDefault(previousState.metaData().settings())));
265265
indexLifecycleService.applyClusterState(event);
266266
indexLifecycleService.clusterChanged(event);
267267
assertThat(indexLifecycleService.getScheduler().jobCount(), equalTo(1));

x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.elasticsearch.common.settings.Settings;
1515
import org.elasticsearch.common.unit.TimeValue;
1616
import org.elasticsearch.common.xcontent.XContentBuilder;
17+
import org.elasticsearch.common.xcontent.json.JsonXContent;
1718
import org.elasticsearch.test.rest.ESRestTestCase;
1819
import org.elasticsearch.xpack.core.indexlifecycle.AllocateAction;
1920
import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction;
@@ -47,9 +48,20 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
4748
private String policy;
4849

4950
@Before
50-
public void refreshIndex() {
51+
public void refreshIndex() throws IOException {
5152
index = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
5253
policy = randomAlphaOfLength(5);
54+
Request request = new Request("PUT", "/_cluster/settings");
55+
XContentBuilder pollIntervalEntity = JsonXContent.contentBuilder();
56+
pollIntervalEntity.startObject();
57+
{
58+
pollIntervalEntity.startObject("transient");
59+
{
60+
pollIntervalEntity.field(LifecycleSettings.LIFECYCLE_POLL_INTERVAL, "1s");
61+
}pollIntervalEntity.endObject();
62+
} pollIntervalEntity.endObject();
63+
request.setJsonEntity(Strings.toString(pollIntervalEntity));
64+
assertOK(adminClient().performRequest(request));
5365
}
5466

5567
public static void updatePolicy(String indexName, String policy) throws IOException {

0 commit comments

Comments
 (0)