Hi,

We have an application that uses the PostgreSQL logical replication API to read the changes made to the PostgreSQL database and applies it to a different database (like Db2 etc). We are using logical replication slots for this. Currently I am facing an issue where the replication slot is pointing to an older restart_lsn and confirmed_flush_lsn (like 10 days back) and the corresponding WAL file is already deleted from the pg_wal directory. Ideally this should not happen, right? since the slot is holding this LSN the wal file should not have been deleted. Now when I try to use query like

select * from pg_logical_slot_get_changes(<slot_name>,<LSN>, NULL)

or use the logical replication API with a start position as any newer LSN, I get the following error:

ERROR: requested WAL segment pg_wal/000000010000000000000036 has already been removed
SQL state: 58P01.

How do I get past this issue? I have not enabled log archiving. I would also like to know how I can modify the restart_lsn and confirmed_flush_lsn positions of the slot?

Thanks,
Rashmi