Is there a efficient way to check if the Postgres
backups (for managed services like RDS
and Cloudsql
) are not corrupted?
Currently one of the ways we are implementing this check is in the following way:
- spin up a new DB from the
backup
and - run a
vacuum
- if the vacuum runs successful we are considering the backup is not corrupted
- delete the test DB
Does this sound like a valid approach and any better solution to this?
PS: GCP has this open source tool to test on their end, but did not understand how we can implement or use it on a managed PG instance. https://github.com/google/pg_page_verification
Thanks in advance!
Regarding Amazon RDS, there is no need to check corruption.
The RDS service is managed and theoretically guarantees a snapshot is valid when you create the snapshot.
If you would like to manually check the integrity, the process you've outlined is a sure-fire way at a high level.
At a low level,
pg_checksums
is also a great way to check integrity (which thepg_page_verification
tool you mention uses).Disclaimer: I am aware of situations where RDS snapshots have become corrupted in very, very rare cases over the years but they have been extremely rare & ultimately, compensation has been offered due to a breach of the SLA.
This should, however, not be a worry 99.95% of the time.