Integrity test before backup

15 views
Skip to first unread message

Marcelo Fortes

unread,
Feb 25, 2025, 2:39:19 PMFeb 25
to Barman, Backup and Recovery Manager for PostgreSQL
Hi folks,

I just developed a very simple database integrity test module in python that do some small checking to check database before it performs any backup the general idea is it only perform backups on healthy database doing some small checking tests

If it don't find any error returned by 
- pg_amcheck,
- pg_check, 
- pg_dump,
- enabled checksums (optional checking) 
it does not perform backup. 

It's a simple implementation, but it can evolve to other validation checking in near future.

I wrote it initially in shellscript but translated to python because I thought it would be directly integrated to barman, so I thought, why not contribute to Barman guys? Anyway better ask first a better way to integrate to barman if you have any interest please let me know. 

Best regards

Martin Marques

unread,
Mar 17, 2025, 5:06:36 AMMar 17
to pgba...@googlegroups.com
Why would you want to "not" take a backup if any of those actions fail? IMO those checks are important for the monitoring of your system, but shouldn't prevent you from taking a physical backup.

--
--
You received this message because you are subscribed to the "Barman for PostgreSQL" group.
To post to this group, send email to pgba...@googlegroups.com
To unsubscribe from this group, send email to
pgbarman+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pgbarman?hl=en?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/pgbarman/0ececdde-fdae-40ff-97a6-a69d06feb939n%40googlegroups.com.

Luca Ferrari

unread,
Mar 17, 2025, 5:23:52 AMMar 17
to pgba...@googlegroups.com
On Mon, Mar 17, 2025 at 10:06 AM 'Martin Marques' via Barman, Backup
and Recovery Manager for PostgreSQL <pgba...@googlegroups.com> wrote:
>
> Why would you want to "not" take a backup if any of those actions fail? IMO those checks are important for the monitoring of your system, but shouldn't prevent you from taking a physical backup.
>

I don't see the point neither. Moreover, having to check if you want
to do a phisycal backup by mens of pg_dump means that your databases
have to be small in size, so it will not scale as an approach.
Seems to me there is a wrong mentality here: if the database does not
have issues, then is in good health, so I don't need backups. Clearly,
backups are not useful only to restore from a corrupted database, also
for getting back in time.
Doing a backup once a problem is in place is a good way to get more troubles.
Luca
Reply all
Reply to author
Forward
0 new messages