Skip to content

Commit 32173a8

Browse files
authored
ILM: add frozen phase (#60983) (#61035)
This adds a frozen phase to ILM that will allow the execution of the set_priority, unfollow, allocate, freeze and searchable_snapshot actions. The frozen phase will be executed after the cold and before the delete phase. (cherry picked from commit 6d01480) Signed-off-by: Andrei Dan <[email protected]>
1 parent 25404cb commit 32173a8

File tree

10 files changed

+142
-13
lines changed

10 files changed

+142
-13
lines changed

docs/reference/ilm/actions/ilm-allocate.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[[ilm-allocate]]
33
=== Allocate
44

5-
Phases allowed: warm, cold.
5+
Phases allowed: warm, cold, frozen.
66

77
Updates the index settings to change which nodes are allowed to host the index shards
88
and change the number of replicas.

docs/reference/ilm/actions/ilm-freeze.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[[ilm-freeze]]
33
=== Freeze
44

5-
Phases allowed: cold.
5+
Phases allowed: cold, frozen.
66

77
<<frozen-indices, Freezes>> an index to minimize its memory footprint.
88

docs/reference/ilm/actions/ilm-searchable-snapshot.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[[ilm-searchable-snapshot]]
33
=== Searchable snapshot
44

5-
Phases allowed: cold.
5+
Phases allowed: cold, frozen.
66

77
Takes a snapshot of the managed index in the configured repository
88
and mounts it as a searchable snapshot.

docs/reference/ilm/actions/ilm-set-priority.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[[ilm-set-priority]]
33
=== Set priority
44

5-
Phases allowed: hot, warm, cold.
5+
Phases allowed: hot, warm, cold, frozen.
66

77
Sets the <<recovery-prioritization, priority>> of the index as
88
soon as the policy enters the hot, warm, or cold phase.

docs/reference/ilm/actions/ilm-unfollow.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[[ilm-unfollow]]
33
=== Unfollow
44

5-
Phases allowed: hot, warm, cold.
5+
Phases allowed: hot, warm, cold, frozen.
66

77
Converts a {ref}/ccr-apis.html[{ccr-init}] follower index into a regular index.
88
This enables the shrink, rollover, and searchable snapshot actions

docs/reference/ilm/ilm-index-lifecycle.asciidoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
<titleabbrev>Index lifecycle</titleabbrev>
77
++++
88

9-
{ilm-init} defines four index lifecycle _phases_:
9+
{ilm-init} defines five index lifecycle _phases_:
1010

1111
* **Hot**: The index is actively being updated and queried.
1212
* **Warm**: The index is no longer being updated but is still being queried.
1313
* **Cold**: The index is no longer being updated and is seldom queried. The
1414
information still needs to be searchable, but it's okay if those queries are
1515
slower.
16+
* **Frozen**: The index is no longer being updated and is seldom queried. The
17+
queries are performing longer-term analyses for which a slower response is
18+
acceptable.
1619
* **Delete**: The index is no longer needed and can safely be removed.
1720

1821
An index's _lifecycle policy_ specifies which phases
@@ -93,6 +96,14 @@ the rollover criteria, it could be 20 minutes before the rollover is complete.
9396
ifdef::permanently-unreleased-branch[]
9497
- <<ilm-searchable-snapshot, Searchable Snapshot>>
9598
endif::[]
99+
* Frozen
100+
- <<ilm-set-priority-action,Set Priority>>
101+
- <<ilm-unfollow-action,Unfollow>>
102+
- <<ilm-allocate,Allocate>>
103+
- <<ilm-freeze,Freeze>>
104+
ifdef::permanently-unreleased-branch[]
105+
- <<ilm-searchable-snapshot, Searchable Snapshot>>
106+
endif::[]
96107
* Delete
97108
- <<ilm-wait-for-snapshot-action,Wait For Snapshot>>
98109
- <<ilm-delete,Delete>>

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,30 @@ public class TimeseriesLifecycleType implements LifecycleType {
3434
static final String HOT_PHASE = "hot";
3535
static final String WARM_PHASE = "warm";
3636
static final String COLD_PHASE = "cold";
37+
static final String FROZEN_PHASE = "frozen";
3738
static final String DELETE_PHASE = "delete";
38-
static final List<String> VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, DELETE_PHASE);
39+
static final List<String> VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, FROZEN_PHASE, DELETE_PHASE);
3940
static final List<String> ORDERED_VALID_HOT_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, RolloverAction.NAME,
4041
ForceMergeAction.NAME);
4142
static final List<String> ORDERED_VALID_WARM_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, ReadOnlyAction.NAME,
4243
AllocateAction.NAME, ShrinkAction.NAME, ForceMergeAction.NAME);
4344
static final List<String> ORDERED_VALID_COLD_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME,
4445
FreezeAction.NAME, SearchableSnapshotAction.NAME);
46+
static final List<String> ORDERED_VALID_FROZEN_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME,
47+
FreezeAction.NAME, SearchableSnapshotAction.NAME);
4548
static final List<String> ORDERED_VALID_DELETE_ACTIONS = Arrays.asList(WaitForSnapshotAction.NAME, DeleteAction.NAME);
4649
static final Set<String> VALID_HOT_ACTIONS = Sets.newHashSet(ORDERED_VALID_HOT_ACTIONS);
4750
static final Set<String> VALID_WARM_ACTIONS = Sets.newHashSet(ORDERED_VALID_WARM_ACTIONS);
4851
static final Set<String> VALID_COLD_ACTIONS = Sets.newHashSet(ORDERED_VALID_COLD_ACTIONS);
52+
static final Set<String> VALID_FROZEN_ACTIONS = Sets.newHashSet(ORDERED_VALID_FROZEN_ACTIONS);
4953
static final Set<String> VALID_DELETE_ACTIONS = Sets.newHashSet(ORDERED_VALID_DELETE_ACTIONS);
5054
private static Map<String, Set<String>> ALLOWED_ACTIONS = new HashMap<>();
5155

5256
static {
5357
ALLOWED_ACTIONS.put(HOT_PHASE, VALID_HOT_ACTIONS);
5458
ALLOWED_ACTIONS.put(WARM_PHASE, VALID_WARM_ACTIONS);
5559
ALLOWED_ACTIONS.put(COLD_PHASE, VALID_COLD_ACTIONS);
60+
ALLOWED_ACTIONS.put(FROZEN_PHASE, VALID_FROZEN_ACTIONS);
5661
ALLOWED_ACTIONS.put(DELETE_PHASE, VALID_DELETE_ACTIONS);
5762
}
5863

@@ -141,6 +146,9 @@ public List<LifecycleAction> getOrderedActions(Phase phase) {
141146
case COLD_PHASE:
142147
return ORDERED_VALID_COLD_ACTIONS.stream().map(a -> actions.getOrDefault(a, null))
143148
.filter(Objects::nonNull).collect(Collectors.toList());
149+
case FROZEN_PHASE:
150+
return ORDERED_VALID_FROZEN_ACTIONS.stream().map(a -> actions.getOrDefault(a, null))
151+
.filter(Objects::nonNull).collect(Collectors.toList());
144152
case DELETE_PHASE:
145153
return ORDERED_VALID_DELETE_ACTIONS.stream().map(a -> actions.getOrDefault(a, null))
146154
.filter(Objects::nonNull).collect(Collectors.toList());
@@ -162,6 +170,9 @@ public String getNextActionName(String currentActionName, Phase phase) {
162170
case COLD_PHASE:
163171
orderedActionNames = ORDERED_VALID_COLD_ACTIONS;
164172
break;
173+
case FROZEN_PHASE:
174+
orderedActionNames = ORDERED_VALID_FROZEN_ACTIONS;
175+
break;
165176
case DELETE_PHASE:
166177
orderedActionNames = ORDERED_VALID_DELETE_ACTIONS;
167178
break;

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicyTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public static LifecyclePolicy randomTimeseriesLifecyclePolicyWithAllPhases(@Null
105105
return TimeseriesLifecycleType.VALID_WARM_ACTIONS;
106106
case "cold":
107107
return TimeseriesLifecycleType.VALID_COLD_ACTIONS;
108+
case "frozen":
109+
return TimeseriesLifecycleType.VALID_FROZEN_ACTIONS;
108110
case "delete":
109111
return TimeseriesLifecycleType.VALID_DELETE_ACTIONS;
110112
default:
@@ -161,6 +163,8 @@ public static LifecyclePolicy randomTimeseriesLifecyclePolicy(@Nullable String l
161163
return TimeseriesLifecycleType.VALID_WARM_ACTIONS;
162164
case "cold":
163165
return TimeseriesLifecycleType.VALID_COLD_ACTIONS;
166+
case "frozen":
167+
return TimeseriesLifecycleType.VALID_FROZEN_ACTIONS;
164168
case "delete":
165169
return TimeseriesLifecycleType.VALID_DELETE_ACTIONS;
166170
default:

0 commit comments

Comments
 (0)