Repository navigation
Conversation
agourlay
force-pushed
the
delete-malformed-collection-on-failed-restore
branch
from
February 13, 2025 15:15
b937a72 to
fb4d42b
Compare
agourlay
marked this pull request as ready for review
February 13, 2025 15:20
timvisee
approved these changes
Feb 13, 2025
timvisee
left a comment
Member
There was a problem hiding this comment.
Would it be possible to add a test for this?
generall
reviewed
Feb 16, 2025
| "Deleting collection directory for failed snapshot recovery: {:?}", | ||
| collection_path | ||
| ); | ||
| tokio::fs::remove_dir_all(&collection_path).await?; |
Member
There was a problem hiding this comment.
I don't think we can do this in distributed environment. Consider cluster of 3 machines: one machine restores snapshot, 2 other create empty collection. If snapshot recovery fails, we only remove collection from one machine, 2 other machines will still think it exists.
generall
requested changes
Feb 16, 2025
generall
left a comment
Member
There was a problem hiding this comment.
There 2 problems:
- Proposed fix doesn't resolve problem if service is killed during snapshot recovery
- In will create inconsistency in distributed environment.
As an alternative I would propose some options:
- make
restore_local_replica_fromcancel-safe. - tolerate non-existing shards on load and create empty ones instead
- introduce a special type of file which would indicate that shard is not ready for load and should be ignored on load
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.
Tackle #5983
In case of failed snapshot restore via the API, a malformed collection can be left behind preventing the service to properly restart.
This happens because in case of a restore of a non existing collection, we first create a collection and then restore shards into it.
We usually assume that all collection directory with configuration files are well formed but it is not the case anymore here.
Failing to restore a shard leaves behind a malformed collection.
The fix is to delete the whole collection directory IF it was absent before the recovery process.