Skip to content

Remember BACKUP for untarred backups

James Fargher requested to merge encode_backup_id into master

What does this MR do and why?

Fixes #436370 (closed)

Currently when restoring from an untarred backup the backup ID is inferred from backup_information.yml. However previously if the backup had been created using BACKUP then this provided ID is lost. Here we save BACKUP such that it can be used for untarred backups and renamed backups.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Remove any existing backup files so that they cannot interfere.
    $ rm -rf tmp/backups/*
  2. Create an untarred backup with BACKUP specified. Skip db for speed.
    $ bundle exec rake gitlab:backup:create SKIP=tar,db BACKUP=pineapple
    ...
    2024-01-12 03:07:08 UTC -- Backup pineapple is done.
  3. Double check that the created backup_information.yml and repository backups use the provided backup ID:
    $ tree tmp/backups/repositories/manifests/
    tmp/backups/repositories/manifests/
    └── default
        └── @snippets
            ├── 19
            │   └── 58
            │       └── 19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7.git
            │           └── pineapple.toml
    ...
    $ cat tmp/backups/backup_information.yml 
    :backup_id: pineapple
    ...
  4. Restore from the created backup. Make sure at least one repository actually completed rather than being skipped (restores are skipped when files are not found).
    $ bundle exec rake gitlab:backup:restore
    2024-01-12 03:11:26 UTC -- Non tarred backup found in /home/james/src/gitlab-org/gdk/gitlab/tmp/backups, using that
    ...
    {"command":"restore","gl_project_path":"snippets/1","level":"info","msg":"completed restore","pid":70633,"relative_path":"@snippets/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git","storage_name":"default","time":"2024-01-12T03:11:26.315Z"}
Edited by James Fargher

Merge request reports

Loading