Re: Introduce XID age based replication slot invalidation

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: Srinath Reddy Sadipiralla <srinath2133@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>, John H <johnhyvr@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-03-31T16:45:08Z
Lists: pgsql-hackers
Hi,

On Tue, Mar 31, 2026 at 12:25 AM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> Dear Bharath,
>
> Thanks for re-working the project.

Thank you for looking into this.

> While seeing the old discussion, I found that Robert Haas was agaist the XID-based
> invalidation, because it's difficult to determine the cutoff age [1].
> Can you clarify your thought against the point? Are you focusing on solving the
> wraparound issues, not for bloated instance issue?
> The code may not be accepted unless we got his agreement.
>
> [1]: https://www.postgresql.org/message-id/CA+TgmoZTbaaEjSZUG1FL0mzxAdN3qmXksO3O9_PZhEuXTkVnRQ@mail.gmail.com

I summarized what others (Nathan, Robert, Amit, Alvaro, Bertrand) said
about it here with my responses:
https://www.postgresql.org/message-id/CALj2ACVY%2BFd5vC0VjW%3D5VDK9mmt-Y%2BPDZxnBp8ngGAZc24Vv9g%40mail.gmail.com.

Please have a look.

A good setting for this in production scenarios is to set
max_slot_xid_age to vacuum_failsafe_age (1.6B) or little less, so that
autovacuum invalidates the slot before entering failsafe mode,
unblocking datfrozenxid advancement and avoiding XID wraparound
without manual VACUUM or downtime. I added a test for this in the 0002
patch. Please have a look.

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



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix the handling of two GUCs during upgrade.