Re: pgsql: Document XLOG_INCLUDE_XID a little better - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: pgsql: Document XLOG_INCLUDE_XID a little better
Date
Msg-id CAA4eK1+Q6vf5KKACRhYXvyjs0CcS4JPq7gfhRDgKrzARFz6sTw@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Document XLOG_INCLUDE_XID a little better  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: pgsql: Document XLOG_INCLUDE_XID a little better  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Sep 29, 2021 at 8:50 PM Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Tue, Sep 21, 2021 at 6:48 PM Alvaro Herrera <alvherre@alvh.no-ip.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.



pgsql-hackers by date:

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