Skip to content

Conversation

@original-brownbear
Copy link
Contributor

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.

non issue since this hasn't had any effect outside of the not yet released encrypted repository.

closes #72782

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 elastic#72782
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label May 7, 2021
@elasticmachine
Copy link
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()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@original-brownbear
Copy link
Contributor Author

Jenkins run elasticsearch-ci/part-2

@original-brownbear
Copy link
Contributor Author

Thanks Albert!

@original-brownbear original-brownbear merged commit 8e564d4 into elastic:master May 10, 2021
@original-brownbear original-brownbear deleted the 72782 branch May 10, 2021 08:17
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)
@original-brownbear original-brownbear restored the 72782 branch April 18, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.14.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] EncryptedRepositorySecretIntegTests testSnapshotFailsForMasterFailoverWithWrongPassword failing

4 participants