Re: [BUG] [PATCH] Allow physical replication slots to recover from archive after invalidation - Mailing list pgsql-hackers

From Joao Foltran
Subject Re: [BUG] [PATCH] Allow physical replication slots to recover from archive after invalidation
Date
Msg-id CAF8B20Dr28H3pdH472SHSYHdkaOX12BsvBe7D06ssMKmwvqCxQ@mail.gmail.com
Whole thread Raw
In response to Re: [BUG] [PATCH] Allow physical replication slots to recover from archive after invalidation  (Amit Kapila <amit.kapila16@gmail.com>)
List 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.kapila16@gmail.com> wrote:
>
> On Tue, Jan 6, 2026 at 3:26 AM Joao Foltran <joao@foltrandba.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

pgsql-hackers by date:

Previous
From: KAZAR Ayoub
Date:
Subject: Re: Speed up COPY FROM text/CSV parsing using SIMD
Next
From: Robert Treat
Date:
Subject: Re: Optional skipping of unchanged relations during ANALYZE?