Use more descriptive task names for ILM cluster state updates (#34161)
Rather than using "ILM" for everything, we should use more descriptive names so debugging from logs is easier to do. Resolves #34118
This commit is contained in:
parent
6ea396a476
commit
a49d59802a
|
@ -174,7 +174,8 @@ public class IndexLifecycleRunner {
|
||||||
|
|
||||||
private void executeClusterStateSteps(Index index, String policy, Step step) {
|
private void executeClusterStateSteps(Index index, String policy, Step step) {
|
||||||
assert step instanceof ClusterStateActionStep || step instanceof ClusterStateWaitStep;
|
assert step instanceof ClusterStateActionStep || step instanceof ClusterStateWaitStep;
|
||||||
clusterService.submitStateUpdateTask("ILM", new ExecuteStepsUpdateTask(policy, index, step, stepRegistry, nowSupplier));
|
clusterService.submitStateUpdateTask("ilm-execute-cluster-state-steps",
|
||||||
|
new ExecuteStepsUpdateTask(policy, index, step, stepRegistry, nowSupplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -383,18 +384,19 @@ public class IndexLifecycleRunner {
|
||||||
private void moveToStep(Index index, String policy, StepKey currentStepKey, StepKey nextStepKey) {
|
private void moveToStep(Index index, String policy, StepKey currentStepKey, StepKey nextStepKey) {
|
||||||
logger.debug("moveToStep[" + policy + "] [" + index.getName() + "]" + currentStepKey + " -> "
|
logger.debug("moveToStep[" + policy + "] [" + index.getName() + "]" + currentStepKey + " -> "
|
||||||
+ nextStepKey);
|
+ nextStepKey);
|
||||||
clusterService.submitStateUpdateTask("ILM", new MoveToNextStepUpdateTask(index, policy, currentStepKey,
|
clusterService.submitStateUpdateTask("ilm-move-to-step", new MoveToNextStepUpdateTask(index, policy, currentStepKey,
|
||||||
nextStepKey, nowSupplier));
|
nextStepKey, nowSupplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveToErrorStep(Index index, String policy, StepKey currentStepKey, Exception e) {
|
private void moveToErrorStep(Index index, String policy, StepKey currentStepKey, Exception e) {
|
||||||
logger.error("policy [" + policy + "] for index [" + index.getName() + "] failed on step [" + currentStepKey
|
logger.error("policy [" + policy + "] for index [" + index.getName() + "] failed on step [" + currentStepKey
|
||||||
+ "]. Moving to ERROR step.", e);
|
+ "]. Moving to ERROR step.", e);
|
||||||
clusterService.submitStateUpdateTask("ILM", new MoveToErrorStepUpdateTask(index, policy, currentStepKey, e, nowSupplier));
|
clusterService.submitStateUpdateTask("ilm-move-to-error-step",
|
||||||
|
new MoveToErrorStepUpdateTask(index, policy, currentStepKey, e, nowSupplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStepInfo(Index index, String policy, StepKey currentStepKey, ToXContentObject stepInfo) {
|
private void setStepInfo(Index index, String policy, StepKey currentStepKey, ToXContentObject stepInfo) {
|
||||||
clusterService.submitStateUpdateTask("ILM", new SetStepInfoUpdateTask(index, policy, currentStepKey, stepInfo));
|
clusterService.submitStateUpdateTask("ilm-set-step-info", new SetStepInfoUpdateTask(index, policy, currentStepKey, stepInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClusterState setPolicyForIndexes(final String newPolicyName, final Index[] indices, ClusterState currentState,
|
public static ClusterState setPolicyForIndexes(final String newPolicyName, final Index[] indices, ClusterState currentState,
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
|
|
||||||
runner.runPolicy(policyName, indexMetaData, null, randomBoolean());
|
runner.runPolicy(policyName, indexMetaData, null, randomBoolean());
|
||||||
|
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-execute-cluster-state-steps"),
|
||||||
Mockito.argThat(new ExecuteStepsUpdateTaskMatcher(indexMetaData.getIndex(), policyName, step)));
|
Mockito.argThat(new ExecuteStepsUpdateTaskMatcher(indexMetaData.getIndex(), policyName, step)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
|
|
||||||
runner.runPolicy(policyName, indexMetaData, null, randomBoolean());
|
runner.runPolicy(policyName, indexMetaData, null, randomBoolean());
|
||||||
|
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-execute-cluster-state-steps"),
|
||||||
Mockito.argThat(new ExecuteStepsUpdateTaskMatcher(indexMetaData.getIndex(), policyName, step)));
|
Mockito.argThat(new ExecuteStepsUpdateTaskMatcher(indexMetaData.getIndex(), policyName, step)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
runner.runPolicy(policyName, indexMetaData, null, false);
|
runner.runPolicy(policyName, indexMetaData, null, false);
|
||||||
|
|
||||||
assertEquals(1, step.getExecuteCount());
|
assertEquals(1, step.getExecuteCount());
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-move-to-step"),
|
||||||
Mockito.argThat(new MoveToNextStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, null)));
|
Mockito.argThat(new MoveToNextStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, null)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
runner.runPolicy(policyName, indexMetaData, null, false);
|
runner.runPolicy(policyName, indexMetaData, null, false);
|
||||||
|
|
||||||
assertEquals(1, step.getExecuteCount());
|
assertEquals(1, step.getExecuteCount());
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-move-to-error-step"),
|
||||||
Mockito.argThat(new MoveToErrorStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, expectedException)));
|
Mockito.argThat(new MoveToErrorStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, expectedException)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
runner.runPolicy(policyName, indexMetaData, null, false);
|
runner.runPolicy(policyName, indexMetaData, null, false);
|
||||||
|
|
||||||
assertEquals(1, step.getExecuteCount());
|
assertEquals(1, step.getExecuteCount());
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-move-to-step"),
|
||||||
Mockito.argThat(new MoveToNextStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, null)));
|
Mockito.argThat(new MoveToNextStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, null)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
runner.runPolicy(policyName, indexMetaData, null, false);
|
runner.runPolicy(policyName, indexMetaData, null, false);
|
||||||
|
|
||||||
assertEquals(1, step.getExecuteCount());
|
assertEquals(1, step.getExecuteCount());
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-set-step-info"),
|
||||||
Mockito.argThat(new SetStepInfoUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, stepInfo)));
|
Mockito.argThat(new SetStepInfoUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, stepInfo)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ public class IndexLifecycleRunnerTests extends ESTestCase {
|
||||||
runner.runPolicy(policyName, indexMetaData, null, false);
|
runner.runPolicy(policyName, indexMetaData, null, false);
|
||||||
|
|
||||||
assertEquals(1, step.getExecuteCount());
|
assertEquals(1, step.getExecuteCount());
|
||||||
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ILM"),
|
Mockito.verify(clusterService, Mockito.times(1)).submitStateUpdateTask(Mockito.matches("ilm-move-to-error-step"),
|
||||||
Mockito.argThat(new MoveToErrorStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, expectedException)));
|
Mockito.argThat(new MoveToErrorStepUpdateTaskMatcher(indexMetaData.getIndex(), policyName, stepKey, expectedException)));
|
||||||
Mockito.verifyNoMoreInteractions(clusterService);
|
Mockito.verifyNoMoreInteractions(clusterService);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue