On Wed, Jun 29, 2022 at 2:30 PM Angelo Onofri <
angelo...@gmail.com> wrote:
> It is not clear for me what is happening if I choose the option "retention_policy= 2" if I have the parameter max_wal_size = 1gB. Whould it be enough to cover PITR of 24 hours?
>
max_wal_size is on the PostgreSQL side, and tells PostgreSQL to try, I
mean "try", to not store more than 1GB of wals if possible. This means
that if the archiving/streaming is done, and PostgreSQL does not need
anymore the exceeding wals, it will recycle (or delete) them because
_it is safe_ to do.
The retention policy, as far as I remember (it is a while I don't use
barman) forces barman to not nuke backups when running cron if those
backup are still in the recovery window. It means, barman will not
purge backups if they will be newer than your recovery window.
Therefore, I suspect if you don't schedule at least one backup per
week, you will end up with a deleted backup situation.
I suggest also to set the minimum_redundancy setting to a good value
(at least 1 in your case), and if you for any reason are not going to
do a scheduled backup, set the retention policy to redundancy.
Luca