Re: [HACKERS] logical decoding of two-phase transactions

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Ajin Cherian <itsajin(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Date: 2020-11-04 10:32:10
Message-ID: CAA4eK1LuihUXkZCQUPV9vmz-k4aPBXUR9JNQA8iMeO+CWmjqow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 4, 2020 at 3:46 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
> On Wed, Nov 4, 2020 at 9:02 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Wed, Nov 4, 2020 at 3:01 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> > >
> > > On Mon, Nov 2, 2020 at 9:40 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > >
> > > > On Wed, Oct 28, 2020 at 10:50 AM Peter Smith <smithpb2250(at)gmail(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-11-04 11:51:40 Re: hash_array_extended() needs to pass down collation
Previous Message Amit Kapila 2020-11-04 10:29:17 Re: [Patch] Optimize dropping of relation buffers using dlist