Re: Introduce XID age based replication slot invalidation

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, John H <johnhyvr(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Introduce XID age based replication slot invalidation
Date: 2026-09-01 09:07:25
Message-ID: apaVzQ/3tchC1Z0c@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Sep 01, 2026 at 04:13:10AM +0000, Zhijie Hou (Fujitsu) wrote:
> On Tuesday, September 1, 2026 11:20 AM Zhijie Hou (Fujitsu) <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> > On Friday, August 28, 2026 8:17 AM Bharath Rupireddy
> > <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >
> > I am wondering whether we could choose a simpler way. That is, change the
> > launcher to not acquire the slot when it's invalidated. This way the user has
> > the option to drop the slot and disable retain_dead_tuples, or just drop the
> > slot and the launcher will later re-create it if retain_dead_tuples is still
> > enabled.
>
> Note that this might require changes to allow users to drop reserved slots (the
> pg_conflict_detection slot is reserved by design, so users cannot acquire it).
> So this might not be practical.
>
> If we want to avoid this change, a simpler approach is to let the launcher
> auto-drop the invalidated slot, recreate it, and log a WARNING.

IIUC, recreating the slot alone could make the launcher try to move its xmin
backwards, as running workers may still have an older oldest_nonremovable_xid.

Stopping all the workers would avoid that, but looks a bit too disruptive if only
one disabled subscription or one without a running apply worker prevented the
pg_conflict_detection slot from advancing.

I wonder if we could combine the worker side check with a launcher side check,
as Nisha suggested, and back off only the subscriptions holding the slot back?
That would let the other workers continue normally.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-09-01 09:15:09 Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master
Previous Message jian he 2026-09-01 09:04:34 Re: foreign_key test is sensitive to the OID counter