-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Miscellaneous ILM cleanups #118488
Miscellaneous ILM cleanups #118488
Changes from all commits
b54f703
058398f
83560fe
c11b684
8690e6d
716e48a
abf211a
93a7c08
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import org.elasticsearch.cluster.DiffableUtils; | ||
import org.elasticsearch.cluster.metadata.IndexMetadata; | ||
import org.elasticsearch.cluster.metadata.Metadata; | ||
import org.elasticsearch.common.Strings; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.core.Nullable; | ||
|
@@ -42,7 +43,6 @@ | |
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
@@ -269,9 +269,8 @@ public Set<Step.StepKey> parseStepKeysFromPhase(String policy, String currentPha | |
return parseStepsFromPhase(policy, currentPhase, phaseDefNonNull).stream().map(Step::getKey).collect(Collectors.toSet()); | ||
} catch (IOException e) { | ||
logger.trace( | ||
() -> String.format( | ||
Locale.ROOT, | ||
"unable to parse steps for policy [{}], phase [{}], and phase definition [{}]", | ||
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. Oh nice -- we pick up a bug fix! 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. Yeah, I'm just annoyed I didn't catch this on the first go around! |
||
() -> Strings.format( | ||
"unable to parse steps for policy [%s], phase [%s], and phase definition [%s]", | ||
policy, | ||
currentPhase, | ||
phaseDef | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ public class IndexLifecycleTransitionTests extends ESTestCase { | |
public void testMoveClusterStateToNextStep() { | ||
String indexName = "my_index"; | ||
LifecyclePolicy policy = randomValueOtherThanMany( | ||
p -> p.getPhases().size() == 0, | ||
p -> p.getPhases().isEmpty(), | ||
() -> LifecyclePolicyTests.randomTestLifecyclePolicy("policy") | ||
); | ||
Phase nextPhase = policy.getPhases() | ||
|
@@ -125,7 +125,7 @@ public void testMoveClusterStateToNextStep() { | |
public void testMoveClusterStateToNextStepSamePhase() { | ||
String indexName = "my_index"; | ||
LifecyclePolicy policy = randomValueOtherThanMany( | ||
p -> p.getPhases().size() == 0, | ||
p -> p.getPhases().isEmpty(), | ||
() -> LifecyclePolicyTests.randomTestLifecyclePolicy("policy") | ||
); | ||
List<LifecyclePolicyMetadata> policyMetadatas = Collections.singletonList( | ||
|
@@ -176,7 +176,7 @@ public void testMoveClusterStateToNextStepSamePhase() { | |
public void testMoveClusterStateToNextStepSameAction() { | ||
String indexName = "my_index"; | ||
LifecyclePolicy policy = randomValueOtherThanMany( | ||
p -> p.getPhases().size() == 0, | ||
p -> p.getPhases().isEmpty(), | ||
() -> LifecyclePolicyTests.randomTestLifecyclePolicy("policy") | ||
); | ||
List<LifecyclePolicyMetadata> policyMetadatas = Collections.singletonList( | ||
|
@@ -228,7 +228,7 @@ public void testSuccessfulValidatedMoveClusterStateToNextStep() { | |
String indexName = "my_index"; | ||
String policyName = "my_policy"; | ||
LifecyclePolicy policy = randomValueOtherThanMany( | ||
p -> p.getPhases().size() == 0, | ||
p -> p.getPhases().isEmpty(), | ||
() -> LifecyclePolicyTests.randomTestLifecyclePolicy(policyName) | ||
); | ||
Phase nextPhase = policy.getPhases() | ||
|
@@ -1436,6 +1436,6 @@ private void assertClusterStateStepInfo( | |
assertEquals(expectedstepInfoValue, newLifecycleState.stepInfo()); | ||
assertEquals(oldLifecycleState.phaseTime(), newLifecycleState.phaseTime()); | ||
assertEquals(oldLifecycleState.actionTime(), newLifecycleState.actionTime()); | ||
assertEquals(newLifecycleState.stepTime(), newLifecycleState.stepTime()); | ||
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. Nice, another (test) bug fix. |
||
assertEquals(oldLifecycleState.stepTime(), newLifecycleState.stepTime()); | ||
} | ||
} |
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.
Do we not need to worry about HOT_PHASE coming first any more? I don't really understand why it was necessary in the first place.
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.
My read of it is that this code was maybe necessary once, but the loop after this that I didn't remove ended up making this code redundant anyway. https://github.com/elastic/elasticsearch/pull/118488/files/93a7c08283627686d9ef83f7e80793be004c8bb8#diff-ea4f8cb2981d1e363c5308fc815b3ce4f94ec116f7e9691d69bbe63d96c607a4R155-R161
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.
Yeah, that tracks the history -- the first (now redundant) block that I've removed was added in #64883, while the second was added a few months later in #68864.