-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Cache ILM policy name on IndexMetadata #83603
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
Changes from 8 commits
306e01c
6611dc2
0241c70
ac72446
85119a6
5b263dc
5b05683
d3c96ea
508447c
efb6eb9
280b43b
db05f03
343699d
d68db24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 83603 | ||
| summary: Cache ILM policy name on `IndexMetadata` | ||
| area: ILM+SLM | ||
| type: enhancement | ||
| issues: | ||
| - 83582 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,6 +503,9 @@ public static APIBlock readFrom(StreamInput input) throws IOException { | |
|
|
||
| private final int shardsPerNodeLimit; | ||
|
|
||
| @Nullable // if an index isn't managed by ilm, it won't have a policy | ||
| private final String lifecyclePolicyName; | ||
|
|
||
| private final LifecycleExecutionState lifecycleExecutionState; | ||
|
|
||
| private final AutoExpandReplicas autoExpandReplicas; | ||
|
|
@@ -544,6 +547,7 @@ private IndexMetadata( | |
| final boolean ignoreDiskWatermarks, | ||
| @Nullable final List<String> tierPreference, | ||
| final int shardsPerNodeLimit, | ||
| final String lifecyclePolicyName, | ||
| final LifecycleExecutionState lifecycleExecutionState, | ||
| final AutoExpandReplicas autoExpandReplicas, | ||
| final boolean isSearchableSnapshot, | ||
|
|
@@ -588,6 +592,7 @@ private IndexMetadata( | |
| this.ignoreDiskWatermarks = ignoreDiskWatermarks; | ||
| this.tierPreference = tierPreference; | ||
| this.shardsPerNodeLimit = shardsPerNodeLimit; | ||
| this.lifecyclePolicyName = lifecyclePolicyName; | ||
| this.lifecycleExecutionState = lifecycleExecutionState; | ||
| this.autoExpandReplicas = autoExpandReplicas; | ||
| this.isSearchableSnapshot = isSearchableSnapshot; | ||
|
|
@@ -632,6 +637,7 @@ IndexMetadata withMappingMetadata(MappingMetadata mapping) { | |
| this.ignoreDiskWatermarks, | ||
| this.tierPreference, | ||
| this.shardsPerNodeLimit, | ||
| this.lifecyclePolicyName, | ||
| this.lifecycleExecutionState, | ||
| this.autoExpandReplicas, | ||
| this.isSearchableSnapshot, | ||
|
|
@@ -759,6 +765,10 @@ public List<String> getTierPreference() { | |
| return tierPreference; | ||
| } | ||
|
|
||
| public String getLifecyclePolicyName() { | ||
| return lifecyclePolicyName; | ||
| } | ||
|
|
||
| public LifecycleExecutionState getLifecycleExecutionState() { | ||
| return lifecycleExecutionState; | ||
| } | ||
|
|
@@ -807,6 +817,10 @@ public Index getResizeSourceIndex() { | |
| Property.PrivateIndex | ||
| ); | ||
|
|
||
| // LIFECYCLE_NAME is here an as optimization, see LifecycleSettings.LIFECYCLE_NAME and | ||
| // LifecycleSettings.LIFECYCLE_NAME_SETTING for the 'real' version | ||
| public static final String LIFECYCLE_NAME = "index.lifecycle.name"; | ||
|
|
||
| ImmutableOpenMap<String, DiffableStringMap> getCustomData() { | ||
| return this.customData; | ||
| } | ||
|
|
@@ -1642,6 +1656,7 @@ public IndexMetadata build() { | |
| DiskThresholdDecider.SETTING_IGNORE_DISK_WATERMARKS.get(settings), | ||
| tierPreference, | ||
| ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.get(settings), | ||
| settings.get(IndexMetadata.LIFECYCLE_NAME), | ||
|
||
| lifecycleExecutionState, | ||
| AutoExpandReplicas.SETTING.get(settings), | ||
| isSearchableSnapshot, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,19 +6,18 @@ | |
| */ | ||
| package org.elasticsearch.xpack.core.ilm; | ||
|
|
||
| import org.elasticsearch.cluster.metadata.IndexMetadata; | ||
| import org.elasticsearch.common.Strings; | ||
| import org.elasticsearch.common.settings.Setting; | ||
| import org.elasticsearch.core.TimeValue; | ||
| import org.elasticsearch.xpack.core.scheduler.CronSchedule; | ||
|
|
||
| import static org.elasticsearch.common.settings.Setting.timeSetting; | ||
|
|
||
| /** | ||
| * Class encapsulating settings related to Index Lifecycle Management X-Pack Plugin | ||
| */ | ||
| public class LifecycleSettings { | ||
| public static final String LIFECYCLE_POLL_INTERVAL = "indices.lifecycle.poll_interval"; | ||
| public static final String LIFECYCLE_NAME = "index.lifecycle.name"; | ||
| public static final String LIFECYCLE_NAME = IndexMetadata.LIFECYCLE_NAME; | ||
| public static final String LIFECYCLE_INDEXING_COMPLETE = "index.lifecycle.indexing_complete"; | ||
| public static final String LIFECYCLE_ORIGINATION_DATE = "index.lifecycle.origination_date"; | ||
| public static final String LIFECYCLE_PARSE_ORIGINATION_DATE = "index.lifecycle.parse_origination_date"; | ||
|
|
@@ -35,7 +34,7 @@ public class LifecycleSettings { | |
| // already mounted as a searchable snapshot. Those ILM actions will check if the index has this setting name configured. | ||
| public static final String SNAPSHOT_INDEX_NAME = "index.store.snapshot.index_name"; | ||
|
|
||
| public static final Setting<TimeValue> LIFECYCLE_POLL_INTERVAL_SETTING = timeSetting( | ||
| public static final Setting<TimeValue> LIFECYCLE_POLL_INTERVAL_SETTING = Setting.timeSetting( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems unrelated?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just a cleanup commit. "While I was here", so to speak. |
||
| LIFECYCLE_POLL_INTERVAL, | ||
| TimeValue.timeValueMinutes(10), | ||
| TimeValue.timeValueSeconds(1), | ||
|
|
@@ -81,7 +80,7 @@ public class LifecycleSettings { | |
| // This setting configures how much time since step_time should ILM wait for a condition to be met. After the threshold wait time has | ||
| // elapsed ILM will likely stop waiting and go to the next step. | ||
| // Also see {@link org.elasticsearch.xpack.core.ilm.ClusterStateWaitUntilThresholdStep} | ||
| public static final Setting<TimeValue> LIFECYCLE_STEP_WAIT_TIME_THRESHOLD_SETTING = timeSetting( | ||
| public static final Setting<TimeValue> LIFECYCLE_STEP_WAIT_TIME_THRESHOLD_SETTING = Setting.timeSetting( | ||
| LIFECYCLE_STEP_WAIT_TIME_THRESHOLD, | ||
| TimeValue.timeValueHours(12), | ||
| TimeValue.timeValueHours(1), | ||
|
|
@@ -114,7 +113,7 @@ public class LifecycleSettings { | |
| Setting.Property.Dynamic, | ||
| Setting.Property.NodeScope | ||
| ); | ||
| public static final Setting<TimeValue> SLM_RETENTION_DURATION_SETTING = timeSetting( | ||
| public static final Setting<TimeValue> SLM_RETENTION_DURATION_SETTING = Setting.timeSetting( | ||
| SLM_RETENTION_DURATION, | ||
| TimeValue.timeValueHours(1), | ||
| TimeValue.timeValueMillis(500), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.