Hi,
I am putting this here instead of Support-section, because if I am correct then code-/documentation-changes have to be made .
I played around with foreman-maintain backup/restore
under foreman-3.3 and especially in combination with --incremental
I spotted some odd things.
If I create incremental offline backups, incremental tar-archives of /var/lib/pgsql
are created.
If I want to restore them now, the documentation says (supposedly being pretty outdated at version 0.2) to restore the full-backup and all consecutive incremental-backups in separate foreman-maintain restore commands like so:
foreman-maintain restore /tmp/backups/FULL_BACKUP
foreman-maintain restore -i /tmp/backups/FIRST_INCREMENTAL
foreman-maintain restore -i /tmp/backups/SECOND_INCREMENTAL
The problem now is that the restore
commands does more than just extract the archives. It does
$ foreman-maintain restore /tmp/backups/FULL_BACKUP
[Stuff before FULL_BACKUP restore]
* extract FULL_BACKUP to /var/lib/pgsql/data
* Start postgresql.service
* DB: REINDEX
* ...
$ foreman-maintain restore -i /tmp/backups/FIRST_INCREMENTAL
[Stuff before FIRST_INCREMENTAL restore]
* extract FIRST_INCREMENTAL to /var/lib/pgsql/data
...
Which is effectively
- restore the db-data-dir
- make changes to the DB
- restore the db-data-dir from FIRST_INCREMENTAL
- make changes to the DB
…
Which practically has to fail at step 4, does it not? Because the db-data-dir pretty sure changed due to starting the postgresql.service and running operations on the DB.
Since the metadata.yaml
included in the backups kinda points to the previous incremental/full backup, I would expect foreman-maintain to detect this and do something like this:
$ foreman-maintain restore -i /tmp/backups/SECOND_INCREMENTAL
[do stuff before restore]
-> extract files from SECOND_INCREMENTAL/*.tar.gz
-> extract files from FIRST_INCREMENTAL/*.tar.gz
-> extract files from FULL_BACKUP/*.tar.gz
* Start postgresql.service
* DB: REINDEX
* ...
Am I missing something?
Another option would be to enforce inclusion of db-dump files (though this would always backup the full DB).