Skip to content

Conversation

@dakrone
Copy link
Member

@dakrone dakrone commented Aug 24, 2018

This commit removes PhaseAfterStep and all the plumbing associated with it.
Instead, we rely on the LifecyclePolicyRunner to police itself for advancing
phases.

This also makes a modification to the settings that are exposed related to the
current phase, instead of returning the current phase/step/action as-is in the
index.lifecycle.phase (etc) setting, these are now split into:

index.lifecycle.current_phase|action|step - the currently executing
phase/action/step which may or may not have completed
index.lifecycle.next_phase|action|step - the next phase/action/step to which
we will be proceeding

While I don't think these will cause much issue (especially since nothing is
being broken for users here), these changes were required to have the
phase_time correctly updated now that we don't have a "shim" step between
phases. Without these it would be confusing as the index would advance to have
an index.lifecycle.phase setting that was potentially one phase in the future.

Relates to #29823

This commit removes PhaseAfterStep and all the plumbing associated with it.
Instead, we rely on the LifecyclePolicyRunner to police itself for advancing
phases.

This also makes a modification to the settings that are exposed related to the
current phase, instead of returning the current phase/step/action as-is in the
`index.lifecycle.phase` (etc) setting, these are now split into:

`index.lifecycle.current_phase|action|step` - the currently executing
phase/action/step which may or may not have completed
`index.lifecycle.next_phase|action|step` - the next phase/action/step to which
we will be proceeding

While I don't think these will cause much issue (especially since nothing is
being broken for users here), these changes were required to have the
`phase_time` correctly updated now that we don't have a "shim" step between
phases. Without these it would be confusing as the index would advance to have
an `index.lifecycle.phase` setting that was potentially one phase in the future.

Relates to elastic#29823
@dakrone dakrone added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 24, 2018
@dakrone dakrone requested review from colings86 and talevy August 24, 2018 21:33
}
}

private StepKey getNextAfterStep(String currentPhaseName) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the removal of these as a followup to #33037 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Copy link
Contributor

@talevy talevy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, I just left some clarifying questions

}
}

private StepKey getNextAfterStep(String currentPhaseName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

// Before executing this step, we need to check whether the index is
// ready to transition to whatever phase this step is in. If it's
// not, then we need to return and wait until the future when it will be
if (isReadyToTransitionToThisPhase(policy, indexMetaData, currentStep.getKey().getPhase()) == false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this check be in the same place where we make the actual transition? then it doesn't look a LIFECYCLE_FORCED_PHASE would have to be set as a signal back to this execution.

Copy link
Member Author

@dakrone dakrone Aug 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be moved there, because otherwise we would re-execute the current steps' actions until the next phase was ready

return firstStepMap.get(policy);
}

public TimeValue getIndexAgeForPhase(final String policy, final String phase) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep the after naming here until it is actually settled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think calling it getAfterForPhase is more confusing than getIndexAgeForPhase, so I'd like to keep it regardless of what we decide on naming

String currentPhase = LifecycleSettings.LIFECYCLE_PHASE_SETTING.get(indexSettings);
String currentAction = LifecycleSettings.LIFECYCLE_ACTION_SETTING.get(indexSettings);
String currentStep = LifecycleSettings.LIFECYCLE_STEP_SETTING.get(indexSettings);
String currentPhase = LifecycleSettings.LIFECYCLE_NEXT_PHASE_SETTING.get(indexSettings);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it the intention to have getCurrentStepKey return the "NEXT_SETTING", while there exists a "CURRENT_SETTING" that can be misunderstood to be just that, the current setting? seems like it is more a "previous" setting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It technically is a "previous" setting from the viewpoint of the internal code, but from an external view (a user looking at the explain or get-settings output) it's the current step, because the age has not yet advanced enough for it

dakrone added a commit to dakrone/elasticsearch that referenced this pull request Sep 4, 2018
This removes `PhaseAfterStep` in favor of a new `PhaseCompleteStep`. This step
in only a marker that the `LifecyclePolicyRunner` needs to halt until the time
indicated for entering the next phase.

This also fixes a bug where phase times were encapsulated into the policy
instead of dynamically adjusting to policy changes.

Supersedes elastic#33140, which it replaces
@dakrone
Copy link
Member Author

dakrone commented Sep 4, 2018

Closed in favor of #33398

@dakrone dakrone closed this Sep 4, 2018
dakrone added a commit that referenced this pull request Sep 5, 2018
This removes `PhaseAfterStep` in favor of a new `PhaseCompleteStep`. This step
in only a marker that the `LifecyclePolicyRunner` needs to halt until the time
indicated for entering the next phase.

This also fixes a bug where phase times were encapsulated into the policy
instead of dynamically adjusting to policy changes.

Supersedes #33140, which it replaces
Relates to #29823
dakrone added a commit that referenced this pull request Sep 6, 2018
This removes `PhaseAfterStep` in favor of a new `PhaseCompleteStep`. This step
in only a marker that the `LifecyclePolicyRunner` needs to halt until the time
indicated for entering the next phase.

This also fixes a bug where phase times were encapsulated into the policy
instead of dynamically adjusting to policy changes.

Supersedes #33140, which it replaces
Relates to #29823
@dakrone dakrone deleted the ilm-remove-phase-after-step branch February 4, 2019 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/ILM+SLM Index and Snapshot lifecycle management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants