Re: Assertion failure in SnapBuildInitialSnapshot() - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Assertion failure in SnapBuildInitialSnapshot()
Date
Msg-id CAA4eK1+Urvs6ZZhTZ5fD6b0qGM__uiz8e8gwBb9EJAQZkbgEBg@mail.gmail.com
Whole thread Raw
In response to Re: Assertion failure in SnapBuildInitialSnapshot()  (Andres Freund <andres@anarazel.de>)
Responses Re: Assertion failure in SnapBuildInitialSnapshot()
List pgsql-hackers
On Wed, Nov 16, 2022 at 7:30 AM Andres Freund <andres@anarazel.de> wrote:
>
> On 2022-11-15 16:20:00 +0530, Amit Kapila wrote:
> > On Tue, Nov 15, 2022 at 8:08 AM Andres Freund <andres@anarazel.de> wrote:
> > > nor do we enforce in an obvious place that we
> > > don't already hold a snapshot.
> > >
> >
> > We have a check for (FirstXactSnapshot == NULL) in
> > RestoreTransactionSnapshot->SetTransactionSnapshot. Won't that be
> > sufficient?
>
> I don't think that'd e.g. catch a catalog snapshot being held, yet that'd
> still be bad. And I think checking in SetTransactionSnapshot() is too late,
> we've already overwritten MyProc->xmin by that point.
>

So, shall we add the below Asserts in SnapBuildInitialSnapshot() after
we have the Assert for Assert(!FirstSnapshotSet)?
Assert(FirstXactSnapshot == NULL);
Assert(!HistoricSnapshotActive());

-- 
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Next
From: vignesh C
Date:
Subject: Re: Support logical replication of DDLs