Re: [BUG] [PATCH] Allow physical replication slots to recover from archive after invalidation

From: Joao Foltran <joao(at)foltrandba(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUG] [PATCH] Allow physical replication slots to recover from archive after invalidation
Date: 2026-01-22 19:41:13
Message-ID: CAF8B20Dr28H3pdH472SHSYHdkaOX12BsvBe7D06ssMKmwvqCxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit!

Unless we have hot_standby_feedback = on, xmin would be null on the
physical replication slot.

But, even if using that parameter, as long as we know that the standby
already has caught up by using the archived wals then the xmin
wouldn't matter, since we don't need those rows to be visible anymore.

I've attached a simple patch and test here that revalidates the slot
after it is lost. It is still missing any filtering besides checking
if the slot is physical or logical, but we can add filters for
specific invalidations.

Let me know what you think.

Regards,
João Foltran

On Wed, Jan 14, 2026 at 8:21 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Jan 6, 2026 at 3:26 AM Joao Foltran <joao(at)foltrandba(dot)com> wrote:
> >
> > > The slots could be invalidated due to other reasons like
> > > RS_INVAL_IDLE_TIMEOUT as well.
> >
> > We could just filter which invalidation reasons could be "revalidated"
> > for only reasons that can be resolved this way.
> >
>
> Can we make the slot valid even the required WAL is made available
> afterwards? What about the removed rows due to the slot's xmin?
>
> --
> With Regards,
> Amit Kapila.

Attachment Content-Type Size
v1-0001-Revalidate-physical-slot-after-standby-recovery-pg18.patch application/octet-stream 19.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2026-01-22 19:42:52 Re: Optional skipping of unchanged relations during ANALYZE?
Previous Message KAZAR Ayoub 2026-01-22 19:32:43 Re: Speed up COPY FROM text/CSV parsing using SIMD