Re: Checkpoint replication slots later - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Checkpoint replication slots later
Date
Msg-id CAHGQGwEnh2AnOZz+_tfUR9j=xb6FVe=hbHmd0pYPSky5AQ-_Vg@mail.gmail.com
Whole thread
In response to Checkpoint replication slots later  (Ants Aasma <ants.aasma@cybertec.at>)
Responses Re: Checkpoint replication slots later
List pgsql-hackers
On Sun, May 17, 2026 at 1:38 AM Hüseyin Demir <huseyin.d3r@gmail.com> wrote:
>
> Hi Ant,
>
> Good idea.

+1.

CheckPointSnapBuild() and CheckPointLogicalRewriteHeap() call
ReplicationSlotsComputeLogicalRestartLSN(), which seems to use
last_saved_restart_lsn for persistent logical slots. Since
last_saved_restart_lsn is updated by CheckPointReplicationSlots(),
if those functions run before it, their cleanup decisions are still
based on the restart_lsn saved at the previous checkpoint.

So, isn't it better to move them after CheckPointReplicationSlots()
as well, so that logical snapshot and rewrite mapping cleanup can use
the newly saved restart_lsn?

Of course, we'd first need to confirm that doing so is safe, though.

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Missing FSM Update when Updating VM On-access
Next
From: Thom Brown
Date:
Subject: Re: SQL/JSON json_table plan clause