pg_start_backup and small max_wal_size
-
04-10-2020 - |
Question
What will happen, if max_wal_size
gets exceeded during backup?
Specifically, let's consider the following scenario on master:
- Set
max_wal_size
to a very low number. - Run
SELECT pg_start_backup('label', true);
to create a checkpoint. - Perform lots of transactions, so that
max_wal_size
is exceeded.
If I am right, PostgreSQL cannot process WAL files, because doing so would pollute the checkpoint. On the other hand, no new WAL files can be created, because of the limit.
Solution
max_wal_size
is a soft limit - under many scenarios it gets crossed.
Specifically as for pg_start_backup
it just commits and outputs the wal location - if you have archiving in place than you have nothing to worry about.
Starting the backup will create more wal files but doesn't prevent rolling them - that's why you need the archiving as all wal files generated in the duration of the backup are needed for a successful restore.
See: max_wal_size documentation Also: backup documentation