PostgreSQL logical replication slot LSN values

From: "Rashmi V Bharadwaj" <rvbharad(at)in(dot)ibm(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PostgreSQL logical replication slot LSN values
Date: 2019-03-12 11:08:56
Message-ID: OF0D36B415.D372F878-ON002583BB.003D3E56-002583BB.003D3E5B@notes.na.collabserv.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><div>Hi,</div><div><br></div><div>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 <br></div><div><b><br></b></div><div><b>select * from pg_logical_slot_get_changes(&lt;slot_name&gt;,&lt;LSN&gt;, NULL)</b> <br></div><div><br></div><div>or use the logical replication API with a start position as any newer LSN, I get the following error:</div><div><b><br></b></div><div><b>ERROR: requested WAL segment pg_wal/000000010000000000000036 has already been removed
<br>SQL state: 58P01.</b></div><div><br></div><div>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?</div><div><br></div><div>Thanks,</div><div>Rashmi<br><b></b></div></font><BR>

Attachment Content-Type Size
unknown_filename text/html 1.3 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Benedict Holland 2019-03-12 14:10:51 Re: POSTGRES/MYSQL
Previous Message Nicola Contu 2019-03-12 09:49:22 Re: Performance comparison between Pgsql 10.5 and Pgsql 11.2