Need help on understanding of wal_keep-segments and max_wal_size dependency.

Started by Swati yadavabout 5 years ago2 messagesgeneral
Jump to latest
#1Swati yadav
Swati.Yadav@Xoriant.Com

Hello Team

We are using streaming replication without feature archiving and replication slots.

Could you please help us in understanding how replication will works when I set max_wal_size to 1GB, wal_keep_segments set to 300?.

?In this scenario, replication is getting failed. Could you please brief us the causes of failure and how can we fix this issue, apart from using the feature archiving? and replication slots.

Thanks & Regards
Swati Yadav | Xoriant Solutions Pvt. Ltd.
5th floor, Amar Paradigm, Baner Road, Baner,
Near D'mart, Pune - 411 045
http://www.xoriant.com<http://www.xoriant.com/>

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Swati yadav (#1)
Re: Need help on understanding of wal_keep-segments and max_wal_size dependency.

On Mon, 2021-03-15 at 10:00 +0000, Swati yadav wrote:

We are using streaming replication without feature archiving and replication slots.

Could you please help us in understanding how replication will works
when I set max_wal_size to 1GB, wal_keep_segments set to 300.

In this scenario, replication is getting failed. Could you please brief
us the causes of failure and how can we fix this issue, apart from using
the feature archiving and replication slots.

"wal_keep_size" is irrelevant to the question.

"wal_keep_segments = 300" makes PostgreSQL keep 300 old WAL segments around
so that standby servers can catch up after a bit of downtime.

If, however, the downtime is long enough that the standby needs WAL that
is in an even earlier WAL segment that has already been archived and deleted,
the standby won't be able to catch up any more.

If you don't want to use "restore_command" or replication slots, your
only option is to increase "wal_keep_segments".

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com