-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Allow ILM step transition to the phase terminal step #91754
Conversation
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy.
Pinging @elastic/es-data-management (Team:Data Management) |
Hi @andreidan, I've created a changelog YAML for you. |
Map<String, LifecycleAction> actions = new HashMap<>(); | ||
actions.put(SetPriorityAction.NAME, new SetPriorityAction(100)); | ||
Phase hotPhase = new Phase("hot", TimeValue.ZERO, actions); | ||
Map<String, Phase> phases = Collections.singletonMap("hot", hotPhase); | ||
LifecyclePolicy policyWithoutRollover = new LifecyclePolicy("my-policy", phases); | ||
LifecyclePolicyMetadata policyMetadata = new LifecyclePolicyMetadata(policyWithoutRollover, Collections.emptyMap(), 2L, 2L); | ||
|
||
ClusterState existingState = ClusterState.builder(ClusterState.EMPTY_STATE) | ||
.metadata(Metadata.builder(Metadata.EMPTY_METADATA).put(meta, false).build()) | ||
.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
&& (stepRegistry.stepExists(policyName, newStepKey) == false && newStepKey.equals(TerminalPolicyStep.KEY) == false)) { | ||
&& (stepRegistry.stepExists(policyName, newStepKey) == false | ||
&& newStepKey.equals(TerminalPolicyStep.KEY) == false | ||
&& newStepKey.equals(new Step.StepKey(lifecycleState.phase(), PhaseCompleteStep.NAME, PhaseCompleteStep.NAME)) == false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: The new
here threw me off when I read it the first time. What do you think about adding a helper method in org.elasticsearch.xpack.core.ilm.PhaseCompleteStep
:
- Either adding
boolean isFinalStep(StepKey stepKey)
, - or to add a final step key constructor:
public static StepKey stepKey(String phase) {
return new StepKey(phase, NAME, NAME);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank for improving this, I left a minor comment.
@elasticmachine update branch |
@elasticmachine update branch |
x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java
Show resolved
Hide resolved
@elasticmachine update branch |
💔 Backport failed
You can use sqren/backport to manually backport by running |
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy.
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy.
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy. (cherry picked from commit 3962556) Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy. (cherry picked from commit 3962556) Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed: ``` step [{"phase":"warm","action":"complete","name":"complete"}] for index [index] with policy [my-policy] does not exist ``` This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy.
ILM tries to honour the cached phase however, some steps are implicit (e.g. injected actions or the terminal policy/phase step) Currently ILM would throw an exception if the currently cached phase was removed:
This fixes this scenario allowing ILM to transition to the phase complete step even if the phase has been removed from the actual policy.
Part of #91749