Re: Avoid streaming the transaction which are skipped (in corner cases) - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Avoid streaming the transaction which are skipped (in corner cases)
Date
Msg-id CAFiTN-vUk9rEOFL0w6ArgYu6c70-1VvpoXuqbEkC+T0yK3df2Q@mail.gmail.com
Whole thread Raw
In response to Re: Avoid streaming the transaction which are skipped (in corner cases)  (Amit Kapila <amit.kapila16@gmail.com>)
Responses RE: Avoid streaming the transaction which are skipped (in corner cases)
List pgsql-hackers
On Sat, Nov 26, 2022 at 12:15 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Fri, Nov 25, 2022 at 5:38 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > On Fri, Nov 25, 2022 at 1:35 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> > >
> > > During DecodeCommit() for skipping a transaction we use ReadRecPtr to
> > > check whether to skip this transaction or not.  Whereas in
> > > ReorderBufferCanStartStreaming() we use EndRecPtr to check whether to
> > > stream or not. Generally it will not create a problem but if the
> > > commit record itself is adding some changes to the transaction(e.g.
> > > snapshot) and if the "start_decoding_at" is in between ReadRecPtr and
> > > EndRecPtr then streaming will decide to stream the transaction where
> > > as DecodeCommit will decide to skip it.  And for handling this case in
> > > ReorderBufferForget() we call stream_abort().
> > >
> >
> > The other cases are probably where we don't have FilterByOrigin or
> > dbid check, for example, XLOG_HEAP2_NEW_CID/XLOG_XACT_INVALIDATIONS.
> > We anyway actually don't send anything for such cases except empty
> > start/stop messages. Can we add some flag to txn which says that there
> > is at least one change like DML that we want to stream?
> >
>
> We can probably think of using txn_flags for this purpose.

In the attached patch I have used txn_flags to identify whether it has
any streamable change or not and the transaction will not be selected
for streaming unless it has at least one streamable change.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Reid Thompson
Date:
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity
Next
From: Ian Lawrence Barwick
Date:
Subject: Re: Allow file inclusion in pg_hba and pg_ident files