Skip to content

backup: Check for backup before deleting repo

James Liu requested to merge jliu-fix-restore-order into master

This MR fixes the Rails spec failure here as we were essentially attempting to delete the excluded_project twice: https://gitlab.com/gitlab-org/gitlab/-/blob/63a278d4a7671c72277b01cadeabd044accb5c99/spec/tasks/gitlab/backup_rake_spec.rb#L228-238

We noticed the failing spec in a Gitaly version update MR. See Slack thread here.

Reorders the repository restore logic so that we do not remove the repo until we've checked that it has an existing backup. If the repo has no backup, it's skipped from the restore and will be removed later by the caller.

The previous order of operations caused issues when performing a full restore that included a dangling repo (a repo created after the backup was taken). When the Restore function was executed against this repo, it was removed immediately. Then, the remainder of the restore was skipped since no backup existed for that repo. Since the repo was not marked as restored, the caller of the Restore function tried to remove it once again, leading to a "repository not found" error since it had already been erased.

The "missing backup" test case for the restore of a specific backup has been updated to expect that the repo exists to align with this logic

Edited by James Liu

Merge request reports