Skip to content
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

Restore snapshot with include_global_state=true is not reverting some custom metadata #81247

Closed
idegtiarenko opened this issue Dec 2, 2021 · 1 comment · Fixed by #81373
Closed
Assignees
Labels
>bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.

Comments

@idegtiarenko
Copy link
Contributor

idegtiarenko commented Dec 2, 2021

Elasticsearch version (bin/elasticsearch --version): 7.16

Description of the problem including expected versus actual behavior:

According to the code:

final Metadata.Builder mdBuilder = Metadata.builder(currentState.metadata());

and

if (metadata.customs() != null) {
for (ObjectObjectCursor<String, Metadata.Custom> cursor : metadata.customs()) {
if (RepositoriesMetadata.TYPE.equals(cursor.key) == false
&& DataStreamMetadata.TYPE.equals(cursor.key) == false
&& cursor.value instanceof Metadata.NonRestorableCustom == false) {
// TODO: Check request.skipOperatorOnly for Autoscaling policies (NonRestorableCustom)
// Don't restore repositories while we are working with them
// TODO: Should we restore them at the end?
// Also, don't restore data streams here, we already added them to the metadata builder above
mdBuilder.putCustom(cursor.key, cursor.value);
}
}
}

when restoring global state from a snapshot we keep existing metadata as a baseline. This means some custom metadata items are going to be preserved as is if they are not present in a global state from the snapshot (if it was taken before the those were configured or even existed).

Steps to reproduce:

  • start a new cluster
  • configure a snapshot repository
  • create a snapshot (with include_global_state=true)
  • configure any custom metadata that could be restored from a snapshot (for example auto-follow pattern, but not data repository/stream/autoscaling)
    restore from the snapshot (with include_global_state=true)

Expected result:

  • new custom metadata is set to null

Actual result:

  • new custom metadata is kept as is
@idegtiarenko idegtiarenko added >bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs needs:triage Requires assignment of a team area label labels Dec 2, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Dec 2, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants