Validate snippet repos when restoring
What does this MR do?
When GitLab restoring from a backup, we must validate any snippet repositories that get restored.
This MR achieves that by using Snippets::RepositoryValidationService
for each snippet repository that is restored. If it is not valid, that Snippet restoration will cancelled and:
- an error log will be output for that snippet
- the snippet will be removed from the DB
- any associated SnippetRepository will be removed from the DB
- any repository for that snippet will be removed
In order to ensure we don't encounter any problems by removing snippets during a find_each
batch process, or when processing in multiple threads, we will remove all snippets without a repository after the restore iterations have completed.
I haven't added a changelog entry as part of this MR because one was added in the original MR within the same release, here: !43696 (merged)
Refs #266944 (closed)
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry - !43696 (merged)
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Edited by Peter Leitzen