Skip to content

Fix Bug With RepositoryData Caching (#57785)#57800

Merged
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:57785-7.x
Jun 8, 2020
Merged

Fix Bug With RepositoryData Caching (#57785)#57800
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:57785-7.x

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

  • Fix Bug With RepositoryData Caching

This fixes a really subtle bug with caching RepositoryData
that can corrupt a repository.
We were caching RepositoryData serialized in the newest
metadata format. This lead to a confusing situation where
numeric shard generations would be cached in ShardGenerations
that were not written to the repository because the repository
or cluster did not yet support ShardGenerations.
In the case where shard generations are not actually supported yet,
these cached numeric generations are not safe and there's multiple
scenarios where they would be incorrect, leading to the repository
trying to read shard level metadata from index-N that don't exist.
This commit makes it so that cached metadata is always in the same
format as the metadata in the repository.

Relates #57798

backport to #57785

* Fix Bug With RepositoryData Caching

This fixes a really subtle bug with caching `RepositoryData`
that can corrupt a repository.
We were caching `RepositoryData` serialized in the newest
metadata format. This lead to a confusing situation where
numeric shard generations would be cached in `ShardGenerations`
that were not written to the repository because the repository
or cluster did not yet support `ShardGenerations`.
In the case where shard generations are not actually supported yet,
these cached numeric generations are not safe and there's multiple
scenarios where they would be incorrect, leading to the repository
trying to read shard level metadata from index-N that don't exist.
This commit makes it so that cached metadata is always in the same
format as the metadata in the repository.

Relates #57798
@original-brownbear original-brownbear added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs backport labels Jun 8, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore)

@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team. label Jun 8, 2020
@original-brownbear original-brownbear merged commit 004eb8b into elastic:7.x Jun 8, 2020
@original-brownbear original-brownbear deleted the 57785-7.x branch June 8, 2020 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Meta label for distributed team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants