Subject: Re: Checkpoint replication slots later

From: Fujii Masao <[email-masked]>
Date: Fri, 10 Jul 2026 23:55:49 +0900

On Sun, May 17, 2026 at 1:38 AM Hüseyin Demir <[email-masked]> 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