PostgreSQL directory format dump is only partially archived #643
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#643
Loading…
Reference in a new issue
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?
Trying to perform a directory format dump with PostgreSQL
Steps to reproduce (if a bug)
The following configuration used to dump the database:
Actual behavior (if a bug)
Borgmatic do not produce any error, in fact it generate an archive that pass consistency check.
The problem lies in the fact that borgmatic does not seems to wait for
pg_dumpto finish backuping before startingborg create. I assume this is because it makes sense for plain/custom format with the pipe files.But for the directory format it cause borg to start archiving a incomplete backup with only a part of the files generated by pg_dump.
Here are all the files generated by a manual pg_dump I did outside borgmatic:
And here the files list of three archives I did with borgmatic with for each of them a bunch of missing files:
First archive:
Second archive:
Third archive:
Expected behavior (if a bug)
If the format is
directory, borgmatic should wait forpg_dumpprocess to finish before starting archiving with borg.Other notes / implementation ideas
In my case I have to backup multiples databases with the same format for each of them. But I do not know if it is easy for borgmatic to handle multiples format with
directorymixed within when you need to wait forpg_dumpfor some of them.Environment
borgmatic version: 1.7.6
borgmatic installation method: Docker container (Docker Borgmatic)
Borg version: 1.2.3
Python version: 3.11.1
Database version (if applicable): PostgreSQL 15
operating system and version: Alpine 3.17 (within docker image)
This is concerning! Thanks so much for taking the time to file it and provide details. I think your intuition is probably correct here—that borgmatic isn't waiting for
pg_dumpto finish because, for non-directory dump formats, it streams the dump directly to Borg as it's running. Let me dig into this and get back to you.This should be fixed in master now. As far as I can tell, this was a long-standing problem, but it likely didn't manifest for smaller "directory" format database dumps. Thanks again for reporting this!
I'll follow up here when it's released.
Okay, this fix has been released in borgmatic 1.7.7.