| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
| Cc: | 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-04-05 08:03:00 |
| Message-ID: | CAD21AoABTzYoe99gmdvs4D8kwfD=AtaaWFb8C2biMkUncmcXDA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Apr 3, 2026 at 12:05 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Wed, Apr 1, 2026 at 2:21 PM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >
> > On Wed, Apr 1, 2026 at 12:39 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > >
> > > I've reviewed the v7 patch and have some review comments:
> >
> > Thank you for reviewing the patch.
> >
> > I took the above changes into v8 and fixed a typo in using xidLimit
> > instead of slotXidLimit.
> >
> > Please find the attached v8 patches for further review. Thank you!
>
> Thank you, Sawada-san, for reviewing and providing some offlist comments.
>
> 1/ Included a note in the docs to say that logical replication slots
> are also affected by XID age GUC (similar to
> idle_replication_slot_timeout).
>
> 2/ Added the code to disable the XID age invalidation in
> pg_createsubscriber similar to timeout invalidation. Commit 72e6c08fea
> ensured that none of the logical replication slots get invalidated
> during the upgrade. (I believe the work that pg_upgrade and
> pg_createsubscriber do is more important, and the slots created and
> used by them or slots in use during those processes must not interfere
> with the upgrade or creating a logical replica from a standby.)
>
> 3/ Changed the max value of XID age GUC to be equal to that of vacuum
> failsafe age. In my opinion, the best use of max_slot_xid_age would be
> to set it equal to or a little less than vacuum_failsafe_age. Also
> added a note in the docs about this.
>
> 4/ Changed variable names for consistency.
>
> 5/ Added code to MaybeInvalidateXIDAgedSlots() to skip the slot
> invalidation attempt (unnecessary work) when slots are not the reason
> for holding back the OldestXmin. Added an equality check to see if
> OldestXmin is either OldestSlotXmin or OldestSlotCatalogXmin (all
> these OldestXXXXmins are computed from the same ComputeXidHorizons()
> call). This should allow us to skip the slot invalidation attempt when
> a backend is holding the xmin back (a long-running transaction, for
> example).
>
> Please find the attached v9 patches for further review. Thank you!
Thank you for updating the patch!
I've made some changes including moving MaybeInvalidateXidAgedSlot()
to vacuum.c since the function seems more inherently tied to vacuum
context. Also, updated the commit message and fixed typos.
Please review the attached patch.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v10-0001-Introduce-max_slot_xid_age-to-invalidate-old-rep.patch | text/x-patch | 36.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matthias van de Meent | 2026-04-05 09:06:27 | Re: Better shared data structure management and resizable shared data structures |
| Previous Message | Alexander Lakhin | 2026-04-05 08:00:00 | Re: pg_plan_advice |