Re: Persist slot invalidations before publishing them - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Persist slot invalidations before publishing them
Date
Msg-id CAA4eK1LH_yjAwcn87gxdawJn+VsAt5HSjXdfAA7gBB-Gb9BGaA@mail.gmail.com
Whole thread
Responses Re: Deadlock detector fails to activate on a hot standby replica
List pgsql-hackers
On Wed, Aug 26, 2026 at 7:19 PM Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
>
> while reviewing [1], I hit an issue due to the fact that an inactive replication
> slot is marked invalid in shared memory before its new state is persisted.
>
> If ReplicationSlotSave() errors before replacing the state file, the slot is
> invalid in shared memory but still valid on disk. That sounds problematic as the
> resource horizon computations could stop accounting for the slot, remove required
> WAL or rows, and then an immediate restart would restore the old valid slot image.
>
> The same issue exists in synchronize_one_slot(): it copies the invalidation from
> the remote slot into the local synchronized slot before saving it. In that case,
> a save error also prevents a direct retry because the next synchronization sees
> the local slot as already invalid and skips it.
>

Won't the drop_local_obsolete_slots() drop the locally invalidated
slot before trying to synchronize the remote_slot in the next slot?

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Yuhang Qiu
Date:
Subject: Re: [PATCH] Use streaming read I/O in sample scans
Next
From: 达劳里亚斯
Date:
Subject: Re: pg_upgrade --copy-file-range fails with EINVAL on Linux 4.19