Re: pgsql: Document XLOG_INCLUDE_XID a little better

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better
Date: 2021-09-30 10:07:47
Message-ID: CAA4eK1+Q6vf5KKACRhYXvyjs0CcS4JPq7gfhRDgKrzARFz6sTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Sep 29, 2021 at 8:50 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Tue, Sep 21, 2021 at 6:48 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> > Document XLOG_INCLUDE_XID a little better
> >
> > I noticed that commit 0bead9af484c left this flag undocumented in
> > XLogSetRecordFlags, which led me to discover that the flag doesn't
> > actually do what the one comment on it said it does. Improve the
> > situation by adding some more comments.
> >
> > Backpatch to 14, where the aforementioned commit appears.
>
> I'm not sure that saying something is a "hack" is really all that
> useful as documentation.
>
> But more to the point, I think this hack is ugly and needs to be
> replaced with something less hacky.
>

I think we can do better than using XLOG_INCLUDE_XID flag in the
record being inserted. We need this flag so that we can mark
SubTransaction assigned after XLogInsertRecord() is successful. We
can instead output a flag (say sub_xact_assigned) from
XLogRecordAssemble() and pass it to XLogInsertRecord(). Then in
XLogInsertRecord(), we can mark SubTransactionAssigned once the record
is inserted (after or before calling
MarkCurrentTransactionIdLoggedIfAny()).

The other idea could be that in XLogInsertRecord(), we check
IsSubTransactionAssignmentPending() after the record is successfully
inserted and then mark SubTransaction assigned but I think the
previous one is better.

What do you think?

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2021-09-30 13:04:55 pgsql: Repair two portability oversights of new test
Previous Message Michael Paquier 2021-09-29 23:50:03 Re: pgsql: Fix WAL replay in presence of an incomplete record

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-09-30 10:09:07 Re: Added schema level support for publication.
Previous Message Ashutosh Sharma 2021-09-30 10:07:02 non-superusers are allowed to drop the replication user, but are not allowed to alter or even create them, is that ok?