MariaDB database restore does not work with borgmatic >=1.8.0 #738

Closed
opened 2023-08-08 21:22:01 +00:00 by mrclschstr · 9 comments

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

### 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
Owner

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.

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.
witten added the
bug
label 2023-08-08 21:29:37 +00:00
Owner

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.

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.
Owner

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.

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.
Author

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!

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!
Owner

Wow, thanks for the quick feedback. I assume that my minimal example is no longer needed?

That's correct!

I'm very looking forward to the fix. Keep up the good work!

Thanks, I'll keep you posted.

> Wow, thanks for the quick feedback. I assume that my minimal example is no longer needed? That's correct! > I'm very looking forward to the fix. Keep up the good work! Thanks, I'll keep you posted.
Owner

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.

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.
Owner

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.

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.
Author

Restoring databases works again. Thank you for your quick fix!

Restoring databases works again. Thank you for your quick fix!
Owner

Glad to hear it!

Glad to hear it!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#738
No description provided.