Re: PostgreSQL logical replication depends on WAL segments? - Mailing list pgsql-general

From Jeremy Finzel
Subject Re: PostgreSQL logical replication depends on WAL segments?
Date
Msg-id CAMa1XUgA0-saNbbGoshLj7uRumdv6-93V4nwZLXbQETtTObyJA@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL logical replication depends on WAL segments?  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: PostgreSQL logical replication depends on WAL segments?  (Jeremy Finzel <finzelj@gmail.com>)
List pgsql-general

wal retention in pg_wal and wal archiving are different things. The OP got problems cause he deliberately went on to delete files in pg_wal which means he used the wrong method to address a wrong situation.

However, if the OP has still those WAL files archived he can use them to bring logical replication back in synch. Don't ask me how I know : https://www.postgresql.org/message-id/ae8812c3-d138-73b7-537a-a273e15ef6e1%40matrix.gatewaynet.com

I don't think we are disagreeing.  My point is that WAL will be retained in pg_wal if it is still needed by a replication slot, and any one of those WAL files will not be archived and recycled as long as it no longer needed by a replication slot.  So yes, they are different things, but they are related in that sense.

It sounded to me like he had an old slot in place pointing to old WAL files, which the cron job removed, thus leading to his error.

Sure, he can recover from this by moving those WAL files back into pg_wal.  But my point is simply that he should rely on WAL archiving rather than archiving via cron because Postgres handles knowing whether or not a replication slot still needs a WAL file.

Thanks,
Jeremy

pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: PostgreSQL logical replication depends on WAL segments?
Next
From: Jeremy Finzel
Date:
Subject: Re: PostgreSQL logical replication depends on WAL segments?