| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
| Cc: | 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-08-19 11:09:16 |
| Message-ID: | CAA4eK1+tVuyqpcaU2GU2SUoXtjUC6S3N5EHYDZ4pf92NDdRK=A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Aug 19, 2026 at 1:13 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Mon, Aug 17, 2026 at 10:46 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > > > so is it okay to keep the same behaviour
> > > > for both max_slot_xid_age and idle_replication_slot_timeout w.r.t
> > > > synced slots? I am not sure if this is a real risk or just a
> > > > theoretical possibility but wanted to bring it to your attention so
> > > > that we can consider it.
> > >
> > > 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.
>
> > but I think it is better to let users build some alerting
> > system before these slots get invalidated. We can add a column similar
> > to wal_status in pg_replication_slots which could help users to
> > indicate that the particular slot is in danger of invalidation.
>
> My initial thought is that one can derive such information using the
> existing slot's xmin and catalog_xmin columns along with the
> max_slot_xid_age GUC value, something like [1], and create alarms if
> needed.
>
This works for me.
> XID-age based replication slot invalidation doesn't have intermediate
> phases like WAL-based invalidation does, so wal_status makes sense for
> WAL-based invalidation but may not be as applicable here.
>
> That said, I'm open to other thoughts on this.
>
> > Additionally, for synced slots, we could add a LOG/WARNING when they
> > are nearing invalidation as there are no direct consumers for the
> > same.
>
> That's an interesting idea. I see this as useful not just for XID-age
> based invalidation but for slot invalidation in general. Having some
> warning before a slot gets invalidated, something like when the
> database approaches XID wraparound limits, whether built into core or
> via a documented SQL query, would be nice to have. It's worth
> discussing separately.
>
I thought for synced slots, it is important as there is no active
consumer for them.
--
With Regards,
Amit Kapila.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Cagri Biroglu | 2026-08-19 11:10:04 | Re: Per-table resync for logical replication subscriptions |
| Previous Message | Jakub Wartak | 2026-08-19 10:39:08 | Re: MPTCP - multiplexing many TCP connections through one socket to get better bandwidth |