Skip to content

backup: Only delete repositories missing from a restore

James Liu requested to merge jliu-track-restored-repos-2 into master

Issue: #5357 (closed)

Based off !6576 (commits) (merge that first).

This MR modifies the repository restore logic so that only "dangling" repositories are removed during a restore. A dangling repository is one which was created after the backup was taken. These need to be explicitly removed from Gitaly storages so that Rails and Gitaly have the same view of repositories in the GitLab instance. Otherwise, IDs can conflict when a user tries to create a repo in the newly restored instance.

The restore logic now calls the WalkRepos RPC to determine the relative paths of all repositories on each storage being restored. WalkRepos is intercepted in Praefect to query the database as the source of truth, rather than performing a filesystem walk. Any repos in this set which were not part of the restore are deleted using RemoveRepository.

There is no expected difference from the user's standpoint.

Edited by James Liu

Merge request reports

Loading