Re: Assertion failure in SnapBuildInitialSnapshot()

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Pradeep Kumar <spradeepkumar29(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Assertion failure in SnapBuildInitialSnapshot()
Date: 2025-11-07 04:05:31
Message-ID: CAA4eK1L+Avbp46_VPd1tBW8vex_NuZtCWxgD_4cgvBaxtPkPWQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 7, 2025 at 8:30 AM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Friday, November 7, 2025 2:36 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > On Thu, Nov 6, 2025 at 2:36 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> > wrote:
> > >
> > > Good point. This can happen when the last slot is invalidated or dropped.
> >
> > After the last slot is invalidated or dropped, both slot_xmin and
> > slot_catalog_xmin values are set InvalidTransactionId. Then in this
> > case, these values are ignored when computing the oldest safe decoding
> > XID in GetOldestSafeDecodingTransactionId(), no? Or do you mean that
> > there is a case where slot_xmin and slot_catalog_xmin retreat to a
> > valid XID?
>
> I think when replication_slot_xmin is invalid,
> GetOldestSafeDecodingTransactionId would return nextXid, which can be greater
> than the original snap.xmin if some transaction IDs have been assigned.
>

Won't we have a problem that values of
procArray->replication_slot_xmin and
procArray->replication_slot_catalog_xmin won't be set to
InvalidTransactionId after last slot removal due to a new check unless
we do special treatment for drop/invalidation of a slot? And that
would lead to accumulating dead rows even when not required.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-11-07 04:22:18 Re: Calling PGReserveSemaphores() from CreateOrAttachShmemStructs
Previous Message Peter Smith 2025-11-07 04:04:29 Re: Skipping schema changes in publication