Unpack a previous backup for incremental backup
What does this MR do and why?
Creating incremental backups requires access to the previous backup in order to create a differential. To allow this, previously creating an incremental backup required SKIP=tar
. Instead of forcing this requirement, here we are unpacking a specified backup first.
We're assuming here that it's okay to overwrite the previous backup tar file. Most of the backup tasks do not support incremental backups yet. So these will essentially be writing a new full backup over the last full backup.
How to set up and validate locally
- Make sure the feature is enabled.
Feature.enable(:incremental_repository_backup)
- Create a full backup.
$ bundle exec rake gitlab:backup:create ... 2022-03-24 14:53:58 +1300 -- Backup 1648086824_2022_03_24_14.10.0-pre is done.
- Find a target project to inspect.
[1] pry(main)> Project.find(20).repository.relative_path => "@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b.git"
- Push changes to the target repo (anything except a branch delete).
- Take an incremental backup. Notice that the backup timestamp printed at the end is the same, the backup gets overwritten.
$ bundle exec rake gitlab:backup:create INCREMENTAL=yes BACKUP=1648086824_2022_03_24_14.10.0-pre ... 2022-03-24 14:56:47 +1300 -- Backup 1648086824_2022_03_24_14.10.0-pre is done.
- Check that a new increment was added for the target repo. We expect to see files named
002
. Strip off the.git
from the target repo above and add it torepositories/
for the directory within the tar file.$ tar tvf tmp/backups/1648086824_2022_03_24_14.10.0-pre_gitlab_backup.tar repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b drwx------ james/james 0 2022-03-24 14:53 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/ drwx------ james/james 0 2022-03-24 14:56 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/ -rw------- james/james 824684 2022-03-24 14:56 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/002.refs -rw------- james/james 824684 2022-03-24 14:53 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/001.refs -rw------- james/james 1319756122 2022-03-24 14:53 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/001.bundle -rw------- james/james 3 2022-03-24 14:53 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/LATEST -rw------- james/james 17 2022-03-24 14:56 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/20220324015346/002.bundle -rw------- james/james 14 2022-03-24 14:53 repositories/@hashed/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b/LATEST
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by James Fargher