MariaDB database restore does not work with borgmatic >=1.8.0 #738
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I'm having a hard time describing my problem, but I'll try to keep it to the essentials. If important details are missing, I can of course provide them!
I am running an all-container Nextcloud setup consisting of four containers: Nextcloud, MariaDB, Redis and borgmatic. The borgmatic container backs up the Nextcloud data and the MariaDB database to my Hetzner storage box once a day.
In recent tests I noticed that the database restore with borgmatic since version 1.8.0 does not work anymore. No data is restored and no error messages are generated during the restore. With version 1.7.15 the restore still works without problems. For comparison I have executed the command
borgmatic restore --archive latest --verbosity 2
with borgmatic version 1.7.15 as well as with version 1.8.1 (see attached files).If you compare the two files, you can see that with the old borgmatic version the hook
restore_database_dump
is executed correctly. However, this is completely missing when running the restore with version 1.8.1.Steps to reproduce
I am currently working on a minimal example. I hope that my problem is basically recognizable from the attached command outputs (see above).
Actual behavior
The database restore does not work using borgmatic version >=1.8.0. No tables are restored, but no error message is shown.
Expected behavior
The database restore works like in borgmatic version 1.7.15.
Other notes / implementation ideas
No response
borgmatic version
borgmatic 1.8.1
borgmatic installation method
Container (https://github.com/modem7/docker-borgmatic)
Borg version
borg 1.2.4
Python version
python 3.11.4
Database version (if applicable)
10.5.21-MariaDB
Operating system and version
Ubuntu 22.04.3 LTS
Thanks for filing this and including detailed logs! Nothing obvious comes to mind when looking at them though, so I'll see if I can repro this locally or at minimum figure out where something might be going wrong in the code.
Good news: It repros locally here in 1.8.0, 1.8.1, and main. If I had to guess, it would be that this issue is breakage from the configuration file format change to remove sections (#721). I'll dig into the code and let you know what I find.
EDIT: Looks like this isn't just MySQL/MariaDB. Other database hooks are similarly broken for restore.
Another update: I have a fix in hand, but I'm hoping to write some failing automated tests before making the change so as to catch this sort of regression in the future.
Wow, thanks for the quick feedback. I assume that my minimal example is no longer needed?
I'm very looking forward to the fix. Keep up the good work!
That's correct!
Thanks, I'll keep you posted.
An update: The end-to-end tests for this are proving tricky, likely because restores being disabled was masking latent issues with at least one of the database systems (MongoDB, for starters). I'm digging into those issues now, but it make take a while. I do think all of this underscores the need for better automated test coverage on restores—which will hopefully be in place after this work is done.
This has been fixed and released in borgmatic 1.8.2. The automated tests were a huge pain, but I'm glad they're in place now. Thanks again for the bug report, and please let me know if you have any further problems with this.
Restoring databases works again. Thank you for your quick fix!
Glad to hear it!