diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTask.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTask.java
index 600df51c13fd2..a0bbf130d4315 100644
--- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTask.java
+++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTask.java
@@ -127,14 +127,18 @@ public ClusterState doExecute(final ClusterState currentState) throws IOExceptio
return state;
} else {
logger.trace("[{}] moving cluster state to next step [{}]", index.getName(), nextStepKey);
- state = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- state,
- nextStepKey,
- nowSupplier,
- policyStepsRegistry,
- false
- );
+ state = ClusterState.builder(state)
+ .putProjectMetadata(
+ IndexLifecycleTransition.moveIndexToStep(
+ index,
+ state.metadata().getProject(),
+ nextStepKey,
+ nowSupplier,
+ policyStepsRegistry,
+ false
+ )
+ )
+ .build();
}
} else {
// cluster state wait step so evaluate the
@@ -170,14 +174,18 @@ public ClusterState doExecute(final ClusterState currentState) throws IOExceptio
if (nextStepKey == null) {
return state;
} else {
- state = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- state,
- nextStepKey,
- nowSupplier,
- policyStepsRegistry,
- false
- );
+ state = ClusterState.builder(state)
+ .putProjectMetadata(
+ IndexLifecycleTransition.moveIndexToStep(
+ index,
+ state.metadata().getProject(),
+ nextStepKey,
+ nowSupplier,
+ policyStepsRegistry,
+ false
+ )
+ )
+ .build();
}
} else {
final ToXContentObject stepInfo = result.informationContext();
diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java
index 5b5f692674723..cd4fb585b33d4 100644
--- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java
+++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java
@@ -153,7 +153,7 @@ public StepKey resolveStepKey(ClusterState state, Index index, String phase, @Nu
}
/**
- * Move the cluster state to an arbitrary step for the provided index.
+ * Move the project to an arbitrary step for the provided index.
*
* In order to avoid a check-then-set race condition, the current step key
* is required in order to validate that the index is currently on the
@@ -161,18 +161,13 @@ public StepKey resolveStepKey(ClusterState state, Index index, String phase, @Nu
* thrown.
* @throws IllegalArgumentException if the step movement cannot be validated
*/
- public ClusterState moveClusterStateToStep(ClusterState currentState, Index index, StepKey currentStepKey, StepKey newStepKey) {
+ public ProjectMetadata moveIndexToStep(ProjectMetadata project, Index index, StepKey currentStepKey, StepKey newStepKey) {
// We manually validate here, because any API must correctly specify the current step key
// when moving to an arbitrary step key (to avoid race conditions between the
- // check-and-set). moveClusterStateToStep also does its own validation, but doesn't take
+ // check-and-set). moveProjectToStep also does its own validation, but doesn't take
// the user-input for the current step (which is why we validate here for a passed in step)
- IndexLifecycleTransition.validateTransition(
- currentState.getMetadata().getProject().index(index),
- currentStepKey,
- newStepKey,
- policyRegistry
- );
- return IndexLifecycleTransition.moveClusterStateToStep(index, currentState, newStepKey, nowSupplier, policyRegistry, true);
+ IndexLifecycleTransition.validateTransition(project.index(index), currentStepKey, newStepKey, policyRegistry);
+ return IndexLifecycleTransition.moveIndexToStep(index, project, newStepKey, nowSupplier, policyRegistry, true);
}
public ClusterState moveClusterStateToPreviouslyFailedStep(ClusterState currentState, String[] indices) {
diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransition.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransition.java
index 4f2f39e052a84..dc38ac5d68276 100644
--- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransition.java
+++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransition.java
@@ -108,29 +108,29 @@ public static void validateTransition(
* For this reason, it is reasonable to throw {@link IllegalArgumentException} when state is not as expected.
*
* @param index The index whose step is to change
- * @param state The current {@link ClusterState}
+ * @param project The current {@link ProjectMetadata}
* @param newStepKey The new step to move the index into
* @param nowSupplier The current-time supplier for updating when steps changed
* @param stepRegistry The steps registry to check a step-key's existence in the index's current policy
* @param forcePhaseDefinitionRefresh Whether to force the phase JSON to be reread or not
* @return The updated cluster state where the index moved to newStepKey
*/
- static ClusterState moveClusterStateToStep(
+ static ProjectMetadata moveIndexToStep(
Index index,
- ClusterState state,
+ ProjectMetadata project,
Step.StepKey newStepKey,
LongSupplier nowSupplier,
PolicyStepsRegistry stepRegistry,
boolean forcePhaseDefinitionRefresh
) {
- IndexMetadata idxMeta = state.getMetadata().getProject().index(index);
+ IndexMetadata idxMeta = project.index(index);
Step.StepKey currentStepKey = Step.getCurrentStepKey(idxMeta.getLifecycleExecutionState());
validateTransition(idxMeta, currentStepKey, newStepKey, stepRegistry);
String policyName = idxMeta.getLifecyclePolicyName();
logger.info("moving index [{}] from [{}] to [{}] in policy [{}]", index.getName(), currentStepKey, newStepKey, policyName);
- IndexLifecycleMetadata ilmMeta = state.metadata().getProject().custom(IndexLifecycleMetadata.TYPE);
+ IndexLifecycleMetadata ilmMeta = project.custom(IndexLifecycleMetadata.TYPE);
LifecyclePolicyMetadata policyMetadata = ilmMeta.getPolicyMetadatas().get(idxMeta.getLifecyclePolicyName());
LifecycleExecutionState lifecycleState = idxMeta.getLifecycleExecutionState();
LifecycleExecutionState newLifecycleState = updateExecutionStateToStep(
@@ -142,7 +142,7 @@ static ClusterState moveClusterStateToStep(
true
);
- return LifecycleExecutionStateUtils.newClusterStateWithLifecycleState(state, idxMeta.getIndex(), newLifecycleState);
+ return project.withLifecycleState(idxMeta.getIndex(), newLifecycleState);
}
/**
diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/MoveToNextStepUpdateTask.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/MoveToNextStepUpdateTask.java
index 610ed006013b2..9c04c635aab92 100644
--- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/MoveToNextStepUpdateTask.java
+++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/MoveToNextStepUpdateTask.java
@@ -49,7 +49,8 @@ public MoveToNextStepUpdateTask(
@Override
public ClusterState doExecute(ClusterState currentState) {
- IndexMetadata idxMeta = currentState.getMetadata().getProject().index(index);
+ final var project = currentState.metadata().getProject();
+ IndexMetadata idxMeta = project.index(index);
if (idxMeta == null) {
// Index must have been since deleted, ignore it
return currentState;
@@ -57,7 +58,9 @@ public ClusterState doExecute(ClusterState currentState) {
LifecycleExecutionState lifecycleState = idxMeta.getLifecycleExecutionState();
if (policy.equals(idxMeta.getLifecyclePolicyName()) && currentStepKey.equals(Step.getCurrentStepKey(lifecycleState))) {
logger.trace("moving [{}] to next step ({})", index.getName(), nextStepKey);
- return IndexLifecycleTransition.moveClusterStateToStep(index, currentState, nextStepKey, nowSupplier, stepRegistry, false);
+ return ClusterState.builder(currentState)
+ .putProjectMetadata(IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, nowSupplier, stepRegistry, false))
+ .build();
} else {
// either the policy has changed or the step is now
// not the same as when we submitted the update task. In
diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportMoveToStepAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportMoveToStepAction.java
index bdf963b059058..5a05a4cc6283b 100644
--- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportMoveToStepAction.java
+++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportMoveToStepAction.java
@@ -147,12 +147,13 @@ public ClusterState execute(ClusterState currentState) {
}
concreteTargetKey.set(concreteTargetStepKey);
- return indexLifecycleService.moveClusterStateToStep(
- currentState,
+ final var updatedProject = indexLifecycleService.moveIndexToStep(
+ currentState.metadata().getProject(),
indexMetadata.getIndex(),
request.getCurrentStepKey(),
concreteTargetKey.get()
);
+ return ClusterState.builder(currentState).putProjectMetadata(updatedProject).build();
}
@Override
diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java
index 26cc9735b0eeb..f47ad5eb1aeb1 100644
--- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java
+++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java
@@ -13,9 +13,12 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.LifecycleExecutionState;
import org.elasticsearch.cluster.metadata.Metadata;
+import org.elasticsearch.cluster.metadata.ProjectId;
+import org.elasticsearch.cluster.metadata.ProjectMetadata;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentHelper;
+import org.elasticsearch.core.FixForMultiProject;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexVersion;
@@ -87,23 +90,16 @@ public void testMoveClusterStateToNextStep() {
long now = randomNonNegativeLong();
// test going from null lifecycle settings to next step
- ClusterState clusterState = buildClusterState(
+ ProjectMetadata project = buildProject(
indexName,
Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policy.getName()),
LifecycleExecutionState.builder().build(),
policyMetadatas
);
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
+ Index index = project.index(indexName).getIndex();
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
- ClusterState newClusterState = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- clusterState,
- nextStep,
- () -> now,
- stepsRegistry,
- false
- );
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
lifecycleState.setPhase(currentStep.phase());
@@ -115,10 +111,10 @@ public void testMoveClusterStateToNextStep() {
lifecycleState.setStepInfo(randomAlphaOfLength(20));
}
- clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
- index = clusterState.metadata().getProject().index(indexName).getIndex();
- newClusterState = IndexLifecycleTransition.moveClusterStateToStep(index, clusterState, nextStep, () -> now, stepsRegistry, false);
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
+ index = project.index(indexName).getIndex();
+ newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
}
public void testMoveClusterStateToNextStepSamePhase() {
@@ -134,7 +130,7 @@ public void testMoveClusterStateToNextStepSamePhase() {
Step.StepKey nextStep = new Step.StepKey("current_phase", "next_action", "next_step");
long now = randomNonNegativeLong();
- ClusterState clusterState = buildClusterState(
+ ProjectMetadata project = buildProject(
indexName,
Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policy.getName()),
LifecycleExecutionState.builder()
@@ -144,17 +140,10 @@ public void testMoveClusterStateToNextStepSamePhase() {
.build(),
policyMetadatas
);
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
+ Index index = project.index(indexName).getIndex();
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
- ClusterState newClusterState = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- clusterState,
- nextStep,
- () -> now,
- stepsRegistry,
- false
- );
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
lifecycleState.setPhase(currentStep.phase());
@@ -166,10 +155,10 @@ public void testMoveClusterStateToNextStepSamePhase() {
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policy.getName());
- clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
- index = clusterState.metadata().getProject().index(indexName).getIndex();
- newClusterState = IndexLifecycleTransition.moveClusterStateToStep(index, clusterState, nextStep, () -> now, stepsRegistry, false);
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
+ index = project.index(indexName).getIndex();
+ newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
}
public void testMoveClusterStateToNextStepSameAction() {
@@ -185,7 +174,7 @@ public void testMoveClusterStateToNextStepSameAction() {
Step.StepKey nextStep = new Step.StepKey("current_phase", "current_action", "next_step");
long now = randomNonNegativeLong();
- ClusterState clusterState = buildClusterState(
+ ProjectMetadata project = buildProject(
indexName,
Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policy.getName()),
LifecycleExecutionState.builder()
@@ -195,17 +184,10 @@ public void testMoveClusterStateToNextStepSameAction() {
.build(),
policyMetadatas
);
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
+ Index index = project.index(indexName).getIndex();
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
- ClusterState newClusterState = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- clusterState,
- nextStep,
- () -> now,
- stepsRegistry,
- false
- );
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
lifecycleState.setPhase(currentStep.phase());
@@ -217,10 +199,10 @@ public void testMoveClusterStateToNextStepSameAction() {
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policy.getName());
- clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
- index = clusterState.metadata().getProject().index(indexName).getIndex();
- newClusterState = IndexLifecycleTransition.moveClusterStateToStep(index, clusterState, nextStep, () -> now, stepsRegistry, false);
- assertClusterStateOnNextStep(clusterState, index, currentStep, nextStep, newClusterState, now);
+ project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
+ index = project.index(indexName).getIndex();
+ newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
+ assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
}
public void testSuccessfulValidatedMoveClusterStateToNextStep() {
@@ -250,17 +232,10 @@ public void testSuccessfulValidatedMoveClusterStateToNextStep() {
lifecycleState.setStep(currentStepKey.name());
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policyName);
- ClusterState clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
- ClusterState newClusterState = IndexLifecycleTransition.moveClusterStateToStep(
- index,
- clusterState,
- nextStepKey,
- () -> now,
- stepRegistry,
- true
- );
- assertClusterStateOnNextStep(clusterState, index, currentStepKey, nextStepKey, newClusterState, now);
+ ProjectMetadata project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
+ Index index = project.index(indexName).getIndex();
+ ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true);
+ assertProjectOnNextStep(project, index, currentStepKey, nextStepKey, newProject, now);
}
public void testValidatedMoveClusterStateToNextStepWithoutPolicy() {
@@ -278,11 +253,11 @@ public void testValidatedMoveClusterStateToNextStepWithoutPolicy() {
lifecycleState.setAction(currentStepKey.action());
lifecycleState.setStep(currentStepKey.name());
- ClusterState clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), List.of());
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
+ ProjectMetadata project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), List.of());
+ Index index = project.index(indexName).getIndex();
IllegalArgumentException exception = expectThrows(
IllegalArgumentException.class,
- () -> IndexLifecycleTransition.moveClusterStateToStep(index, clusterState, nextStepKey, () -> now, stepRegistry, true)
+ () -> IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
);
assertThat(exception.getMessage(), equalTo("index [my_index] is not associated with an Index Lifecycle Policy"));
}
@@ -302,11 +277,11 @@ public void testValidatedMoveClusterStateToNextStepInvalidNextStep() {
lifecycleState.setAction(currentStepKey.action());
lifecycleState.setStep(currentStepKey.name());
- ClusterState clusterState = buildClusterState(indexName, indexSettingsBuilder, lifecycleState.build(), List.of());
- Index index = clusterState.metadata().getProject().index(indexName).getIndex();
+ ProjectMetadata project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), List.of());
+ Index index = project.index(indexName).getIndex();
IllegalArgumentException exception = expectThrows(
IllegalArgumentException.class,
- () -> IndexLifecycleTransition.moveClusterStateToStep(index, clusterState, nextStepKey, () -> now, stepRegistry, true)
+ () -> IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
);
assertThat(exception.getMessage(), equalTo("""
step [{"phase":"next_phase","action":"next_action","name":"next_step"}] \
@@ -1275,6 +1250,17 @@ private ClusterState buildClusterState(
Settings.Builder indexSettingsBuilder,
LifecycleExecutionState lifecycleState,
List lifecyclePolicyMetadatas
+ ) {
+ return ClusterState.builder(ClusterName.DEFAULT)
+ .putProjectMetadata(buildProject(indexName, indexSettingsBuilder, lifecycleState, lifecyclePolicyMetadatas))
+ .build();
+ }
+
+ private ProjectMetadata buildProject(
+ String indexName,
+ Settings.Builder indexSettingsBuilder,
+ LifecycleExecutionState lifecycleState,
+ List lifecyclePolicyMetadatas
) {
Settings indexSettings = indexSettingsBuilder.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
@@ -1289,11 +1275,12 @@ private ClusterState buildClusterState(
.collect(Collectors.toMap(LifecyclePolicyMetadata::getName, Function.identity()));
IndexLifecycleMetadata indexLifecycleMetadata = new IndexLifecycleMetadata(lifecyclePolicyMetadatasMap, OperationMode.RUNNING);
- Metadata metadata = Metadata.builder()
+ @FixForMultiProject // Use non-default ID when the remainder of IndexLifecycleTransition is project-aware.
+ final var projectId = ProjectId.DEFAULT;
+ return ProjectMetadata.builder(projectId)
.put(indexMetadata, true)
.putCustom(IndexLifecycleMetadata.TYPE, indexLifecycleMetadata)
.build();
- return ClusterState.builder(new ClusterName("my_cluster")).metadata(metadata).build();
}
public static void assertIndexNotManagedByILM(ClusterState clusterState, Index index) {
@@ -1312,21 +1299,19 @@ public static void assertIndexNotManagedByILM(ClusterState clusterState, Index i
assertFalse(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE_SETTING.exists(indexSettings));
}
- public static void assertClusterStateOnNextStep(
- ClusterState oldClusterState,
+ public static void assertProjectOnNextStep(
+ ProjectMetadata oldProject,
Index index,
Step.StepKey currentStep,
Step.StepKey nextStep,
- ClusterState newClusterState,
+ ProjectMetadata newProject,
long now
) {
- assertNotSame(oldClusterState, newClusterState);
- Metadata newMetadata = newClusterState.metadata();
- assertNotSame(oldClusterState.metadata(), newMetadata);
- IndexMetadata newIndexMetadata = newMetadata.getProject().getIndexSafe(index);
- assertNotSame(oldClusterState.metadata().getProject().index(index), newIndexMetadata);
- LifecycleExecutionState newLifecycleState = newClusterState.metadata().getProject().index(index).getLifecycleExecutionState();
- LifecycleExecutionState oldLifecycleState = oldClusterState.metadata().getProject().index(index).getLifecycleExecutionState();
+ assertNotSame(oldProject, newProject);
+ IndexMetadata newIndexMetadata = newProject.getIndexSafe(index);
+ assertNotSame(oldProject.index(index), newIndexMetadata);
+ LifecycleExecutionState newLifecycleState = newProject.index(index).getLifecycleExecutionState();
+ LifecycleExecutionState oldLifecycleState = oldProject.index(index).getLifecycleExecutionState();
assertNotSame(oldLifecycleState, newLifecycleState);
assertEquals(nextStep.phase(), newLifecycleState.phase());
assertEquals(nextStep.action(), newLifecycleState.action());