Skip to content

Conversation

@andreidan
Copy link
Contributor

This moves the execution of the searchable_snapshot action before the
migrate action in the cold and frozen phases for a more efficient
data migration (ie. mounting it as a searchable snapshot directly on the
target tier)

Resolves #68635

This moves the execution of the `searchable_snapshot` action before the
`migrate` action in the `cold` and `frozen` phases for a more efficient
data migration (ie. mounting it as a searchable snapshot directly on the
target tier)
@andreidan andreidan added >enhancement :Data Management/ILM+SLM Index and Snapshot lifecycle management v8.0.0 v7.12.0 labels Feb 10, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Feb 10, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@andreidan andreidan requested a review from dakrone February 10, 2021 19:26
@andreidan
Copy link
Contributor Author

Note: I'll have a look over the needed documentation changes (if any) in a subsequent PR.

@andreidan
Copy link
Contributor Author

@elasticmachine update branch

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

I left a couple of small comments, otherwise this looks good!

Comment on lines 136 to 139
if (phase.getActions().get(SearchableSnapshotAction.NAME) != null) {
// the `searchable_snapshot` action defines migration rules itself, so no need to inject a migrate action
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe we still want to inject a migrate action for the frozen phase, so that a searchable snapshot created in the cold phase transitions to frozen nodes when it reaches the frozen phase, even if there is a searchable snapshot action (because the searchable snapshot action could end up being a noop if the settings are the same)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right, good shout!

assert DataTier.validTierName(targetTier) : "invalid data tier name:" + targetTier;

BranchingStep conditionalSkipActionStep = new BranchingStep(preMigrateBranchingKey, migrationKey, nextStepKey,
(index, clusterState) -> skipMigrateAction(phase, clusterState.metadata().index(index)));
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some debug logging about how we're skipping the migration because of XYZ for this? I think it'd be helpful if someone is trying to diagnose why migrate behaves the way it does.

@andreidan
Copy link
Contributor Author

@elasticmachine update branch

@andreidan
Copy link
Contributor Author

Mentioned the relation between the migrate and searchable_snapshot actions in the docs 51ba7c7

@andreidan andreidan requested a review from dakrone February 11, 2021 11:52
…action

Not that searchable_snapshot can precede other actions in the same phase
(eg. in frozen it is followed by `migrate`) we need to allow the mounted
index to resume executing the ILM policy starting with a step that's part
of a new action (ie. migrate).

This adds support to resume the execution of the mounted index from another
action.

With older versions the execution would resume from the PhaseCompleteStep
as it was the last action in a phase, which was handled as a special case
in the `CopyExecutionStateStep`. This commit generalises the `CopyExecutionStateStep`
to be able to resume from any `StepKey`.
Comment on lines -248 to -249
// a policy with only the cold phase will have a null "nextStepKey", hence the "null" nextStepKey passed in below when that's the
// case
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not true anymore. the next step will be the (phase) complete one.

@andreidan
Copy link
Contributor Author

@dakrone having the searchable_snapshot before another action in the same phase surfaced another problem with how we used to copy the ILM execution state from the source index to the mounted one. I addressed this in 5300b2f

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for changing this!

@andreidan andreidan merged commit 800ae51 into elastic:master Feb 15, 2021
andreidan added a commit to andreidan/elasticsearch that referenced this pull request Feb 15, 2021
…tic#68861)

This moves the execution of the `searchable_snapshot` action before the
`migrate` action in the `cold` and `frozen` phases for more efficient
data migration (ie. mounting it as a searchable snapshot directly on the
target tier)

Now that searchable_snapshot can precede other actions in the same phase
(eg. in frozen it is followed by `migrate`) we need to allow the mounted
index to resume executing the ILM policy starting with a step that's part
of a new action (ie. migrate).

This adds support to resume the execution of the mounted index from another
action.

With older versions, the execution would resume from the PhaseCompleteStep
as it was the last action in a phase, which was handled as a special case
in the `CopyExecutionStateStep`. This  generalises the `CopyExecutionStateStep`
to be able to resume from any `StepKey`.

(cherry picked from commit 800ae51)
Signed-off-by: Andrei Dan <[email protected]>
andreidan added a commit that referenced this pull request Feb 15, 2021
…) (#68971)

This moves the execution of the `searchable_snapshot` action before the
`migrate` action in the `cold` and `frozen` phases for more efficient
data migration (ie. mounting it as a searchable snapshot directly on the
target tier)

Now that searchable_snapshot can precede other actions in the same phase
(eg. in frozen it is followed by `migrate`) we need to allow the mounted
index to resume executing the ILM policy starting with a step that's part
of a new action (ie. migrate).

This adds support to resume the execution of the mounted index from another
action.

With older versions, the execution would resume from the PhaseCompleteStep
as it was the last action in a phase, which was handled as a special case
in the `CopyExecutionStateStep`. This  generalises the `CopyExecutionStateStep`
to be able to resume from any `StepKey`.

(cherry picked from commit 800ae51)
Signed-off-by: Andrei Dan <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
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 >enhancement Team:Data Management Meta label for data/management team v7.12.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ILM optimized migrate for searchable snapshot action

4 participants