Re: Persist slot invalidations before publishing them

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: JoongHyuk Shin <sjh910805(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Rui Zhao <zhaorui126(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Persist slot invalidations before publishing them
Date: 2026-09-22 08:27:44
Message-ID: arI8AEPtq4EtgzWL@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi JoongHyuk,

On Sun, Sep 13, 2026 at 07:31:57PM +0900, JoongHyuk Shin wrote:
> Hi Bertrand,
>
> I read v2 and have a question about the window the new ordering opens
> between two invalidators.

Thanks for looking at it!

> If a second invalidator reaches the
> same slot in that window (say a restartpoint enforcing
> max_slot_wal_keep_size while startup is replaying a wal_level change, or
> the other way round), it seems it would take the "slot is in use" path,
> so startup might send a recovery conflict to active_pid, or another
> process a SIGTERM. What do you think?

You're right, v2 could treat the first invalidator as a regular slot user and
terminate it.

Rui, thanks for the patch! I've incorporated its locking approach and test coverage
in v3, with some adjustments around error cleanup.

Please find v3 attached.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-Persist-slot-invalidations-before-publishing-them.patch text/x-diff 29.1 KB
v3-0002-Persist-synchronized-slot-invalidations-before-pu.patch text/x-diff 7.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajit Awekar 2026-09-22 08:44:16 Re: [(known) BUG] DELETE/UPDATE more than one row in partitioned foreign table
Previous Message shveta malik 2026-09-22 08:27:08 Re: sequencesync worker race with REFRESH SEQUENCES