Re: Introduce XID age based replication slot invalidation - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Introduce XID age based replication slot invalidation
Date
Msg-id CALj2ACUi0LeqKzomuXNPFsekzuQ+XbWZ5RamnO6tDzG4i1-KLw@mail.gmail.com
Whole thread
In response to Re: Introduce XID age based replication slot invalidation  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Hi,

On Sat, Aug 15, 2026 at 10:35 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Thu, Aug 13, 2026 at 9:40 PM Bertrand Drouvot
> <bertranddrouvot.pg@gmail.com> wrote:
>
> > Yeah, I agree. Keeping the exemption for idle_replication_slot_timeout but
> > removing it from CanInvalidateXidAgedSlot() makes sense to me.
>
> > Worth adding a test with an actual synced slot, including checking that its
> > invalidation releases the feedback horizon on the primary?
>
> Yes, I will do so. I will turn either one of the following (maybe test
> 2 for determinism) into a test by ensuring that the synced slot on the
> standby gets XID-age invalidated while its corresponding failover slot
> and physical slot on the primary don't get invalidated, and ensure
> that vacuum on the system catalogs doesn't get blocked.
>
> 1/ Slot sync worker stuck or erroring: the synced slot's catalog_xmin
> is old and gets sent onto the physical slot on the primary via HS
> feedback.
> 2/ Slot sync worker is off with rare/missing/forgotten manual syncs:
> the synced slot's catalog_xmin is old and gets sent onto the physical
> slot on the primary via HS feedback.

Added case 2 as a TAP test in the attached 0003 patch.

On Tue, Aug 18, 2026 at 12:42 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Mon, Aug 17, 2026 at 10:46 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > > I believe this can happen in practice (as explained above). IMHO, XID
> > > age based slot invalidation must invalidate the synced slot on the
> > > standby (just like other invalidations except the idle-timeout based)
> > > if its catalog_xmin is aged and blocking vacuum on the primary.
> >
> > Fair enough, then let's invalidate synced slots as well on standby due
> > to xid_age
>
> Thanks. I will post the new patches soon.

Please find the attached v14 patches. 0003 now adds support for
invalidating XID-aged synced replication slots on standbys.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: Bernd Reiß
Date:
Subject: Re: missing possibility to use alternative translated month names in to_char function
Next
From: Richard Guo
Date:
Subject: Wrong results from join removal with DISTINCT ON + SRF subquery