Re: pgsql: Document XLOG_INCLUDE_XID a little better

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-10-04T04:26:29Z
Lists: pgsql-hackers
On Sun, Oct 3, 2021 at 5:05 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Sat, Oct 2, 2021 at 8:10 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> >
> > On 2021-Oct-02, Dilip Kumar wrote:
> >
> > > I have written two patches, Approach1 is as you described using a
> > > static boolean and Approach2 as a local variable to XLogAssembleRecord
> > > as described by Amit, attached both of them for your reference.
> > > IMHO, either of these approaches looks cleaner.
> >
> > Thanks!  I haven't read these patches carefully, but I think the
> > variable is about assigning the *subxid*, not the topxid.  Amit can
> > confirm ...
>
> IIRC, this variable is for logging the top xid in the first WAL by
> each subtransaction. So that during logical decoding, while creating
> the ReorderBufferTxn for the subtransaction we can associate it to the
> top transaction without seeing the commit WAL.
>

This is correct.

-- 
With Regards,
Amit Kapila.



Commits

  1. Move MarkCurrentTransactionIdLoggedIfAny() out of the critical section.

  2. Replace XLOG_INCLUDE_XID flag with a more localized flag.

  3. Document XLOG_INCLUDE_XID a little better

  4. Immediately WAL-log subtransaction and top-level XID association.