Re: [HACKERS] logical decoding of two-phase transactions - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] logical decoding of two-phase transactions
Date
Msg-id CAA4eK1LuihUXkZCQUPV9vmz-k4aPBXUR9JNQA8iMeO+CWmjqow@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] logical decoding of two-phase transactions  (Ajin Cherian <itsajin@gmail.com>)
Responses Re: [HACKERS] logical decoding of two-phase transactions  (Ajin Cherian <itsajin@gmail.com>)
List pgsql-hackers
On Wed, Nov 4, 2020 at 3:46 PM Ajin Cherian <itsajin@gmail.com> wrote:
>
> On Wed, Nov 4, 2020 at 9:02 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > On Wed, Nov 4, 2020 at 3:01 PM Ajin Cherian <itsajin@gmail.com> wrote:
> > >
> > > On Mon, Nov 2, 2020 at 9:40 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 28, 2020 at 10:50 AM Peter Smith <smithpb2250@gmail.com> wrote:
> > > > 2.
> > > > +DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
> > > > +   xl_xact_parsed_prepare * parsed)
> > > > +{
> > > > ..
> > > > + if (SnapBuildXactNeedsSkip(ctx->snapshot_builder, buf->origptr) ||
> > > > + (parsed->dbId != InvalidOid && parsed->dbId != ctx->slot->data.database) ||
> > > > + ctx->fast_forward || FilterByOrigin(ctx, origin_id))
> > > > + return;
> > > > +
> > > >
> > > > I think this check is the same as the check in DecodeCommit, so you
> > > > can write some comments to indicate the same and also why we don't
> > > > need to call ReorderBufferForget here. One more thing is to note is
> > > > even if we don't need to call ReorderBufferForget here but still we
> > > > need to execute invalidations (which are present in top-level txn) for
> > > > the reasons mentioned in ReorderBufferForget. Also, if we do this,
> > > > don't forget to update the comment atop
> > > > ReorderBufferImmediateInvalidation.
> > >
> > > I have updated the comments. I wasn't sure of when to execute
> > > invalidations. Should I only
> > > execute invalidations if this was for another database than what was
> > > being decoded or should
> > > I execute invalidation every time we skip?
> > >
> >
> > I think so. Did there exist any such special condition in DecodeCommit
> > or do you have any other reason in your mind for not doing it every
> > time we skip? We probably might not need to execute when the database
> > is different (at least I can't think of a reason for the same) but I
> > guess this doesn't make much difference and it will keep the code
> > consistent with what we do in DecodeCommit.
> >
>
> I was just basing it on the comments in the DecodeCommit:
>

Okay, so it is mentioned in the comment why we need to execute
invalidations even when the database is not the same. So, we are
probably good here if we are executing the invalidations whenever we
skip to decode the prepared xact.

-- 
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [Patch] Optimize dropping of relation buffers using dlist
Next
From: Peter Eisentraut
Date:
Subject: Re: hash_array_extended() needs to pass down collation