Skip to content

Commit 3a8da31

Browse files
Inject an unfollow action before executing a downsample action in ILM (#128788) (#128941)
When an index alias/data stream is replicated via CCR, the follower index needs to unfollow the leader index before executing actions that will remove the original index. The downsample action is also an action that removes the original index so the expected behaviour is that ILM would automatically unfollow. (cherry picked from commit cc5a2d8) Co-authored-by: Anirudh2112 <[email protected]>
1 parent d097bf0 commit 3a8da31

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

docs/changelog/128788.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 105773
2+
summary: Inject an unfollow action before executing a downsample action in ILM
3+
area: ILM+SLM
4+
type: bug
5+
issues:
6+
- 105773

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public List<Phase> getOrderedPhases(Map<String, Phase> phases) {
132132
if (actions.containsKey(UnfollowAction.NAME) == false
133133
&& (actions.containsKey(RolloverAction.NAME)
134134
|| actions.containsKey(ShrinkAction.NAME)
135-
|| actions.containsKey(SearchableSnapshotAction.NAME))) {
135+
|| actions.containsKey(SearchableSnapshotAction.NAME)
136+
|| actions.containsKey(DownsampleAction.NAME))) {
136137
Map<String, LifecycleAction> actionMap = new HashMap<>(phase.getActions());
137138
actionMap.put(UnfollowAction.NAME, UnfollowAction.INSTANCE);
138139
phase = new Phase(phase.getName(), phase.getMinimumAge(), actionMap);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ public void testUnfollowInjections() {
476476
assertTrue(isUnfollowInjected("cold", SearchableSnapshotAction.NAME));
477477
assertTrue(isUnfollowInjected("frozen", SearchableSnapshotAction.NAME));
478478

479+
assertTrue(isUnfollowInjected("warm", DownsampleAction.NAME));
480+
assertTrue(isUnfollowInjected("cold", DownsampleAction.NAME));
481+
479482
assertFalse(isUnfollowInjected("hot", SetPriorityAction.NAME));
480483
assertFalse(isUnfollowInjected("warm", SetPriorityAction.NAME));
481484
assertFalse(isUnfollowInjected("warm", AllocateAction.NAME));

0 commit comments

Comments
 (0)