Ensure SnapshotsInProgress is Immutable#72842
Merged
original-brownbear merged 1 commit intoelastic:masterfrom May 10, 2021
original-brownbear:72782
Merged
Ensure SnapshotsInProgress is Immutable#72842original-brownbear merged 1 commit intoelastic:masterfrom original-brownbear:72782
original-brownbear merged 1 commit intoelastic:masterfrom
original-brownbear:72782
Conversation
The user metadata map in `SnapshotsInProgress.Entry` must not be mutable. This change makes all the collections in the snapshot entry instances immutable. Unfortunately, the `EncryptedRepository` relies on the fact that this map is mutable so this commit contains a hack to keep it mutable for now. It does not contain a proper fix because work will shortly be merged removing the need for a mutable map in `SnapshotInfo` as well and fixing the current implementation of `EncryptedRepository` would require adjusting the `Repository` interface. closes #72782
Collaborator
|
Pinging @elastic/es-distributed (Team:Distributed) |
| entry.userMetadata(), | ||
| // TODO: remove this hack making the metadata mutable once | ||
| // https://github.com/elastic/elasticsearch/pull/72776 has been merged | ||
| entry.userMetadata() == null ? null : new HashMap<>(entry.userMetadata()), |
Contributor
Author
There was a problem hiding this comment.
The problem with the linked test failure was that the map in the entry was mutated while a snapshot status request was iterating over it. We must not have mutable objects in the cluster state so even though this is a horrible hack it at least gives us safe behavior in how our state machines work.
Contributor
Author
|
Jenkins run elasticsearch-ci/part-2 |
albertzaharovits
approved these changes
May 10, 2021
Contributor
Author
|
Thanks Albert! |
original-brownbear
added a commit
that referenced
this pull request
Jun 29, 2021
) Backport of the recently introduced snapshot pagination and scalability improvements listed below. Merged as a single backport because the `7.x` and master snapshot status API logic had massively diverged between master and 7.x. With the work in the below PRs, the logic in master and 7.x once again has been aligned very closely again. #72842 #73172 #73199 #73570 #73952 #74236 #74451 (this one is only partly applicable as it was mainly a change to master to align `master` and `7.x` branches)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The user metadata map in
SnapshotsInProgress.Entrymust not be mutable.This change makes all the collections in the snapshot entry instances
immutable. Unfortunately, the
EncryptedRepositoryrelies on the fact thatthis map is mutable so this commit contains a hack to keep it mutable
for now. It does not contain a proper fix because work will shortly be merged
removing the need for a mutable map in
SnapshotInfoas well and fixingthe current implementation of
EncryptedRepositorywould require adjustingthe
Repositoryinterface.non issue since this hasn't had any effect outside of the not yet released encrypted repository.
closes #72782