pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better
Date: Wed, 20 Oct 2021 10:39:15 -0300
Message-ID: <202110201339.vrrwchc7jkwo@alvherre.pgsql> (raw)
In-Reply-To: <CAA4eK1J3gC_hQ-CgSF8EVp6K945gNd1zuX0QxDnqyxpWw=_wsQ@mail.gmail.com>

API-wise, this seems a good improvement and it brings a lot of clarity
to what is really going on.  Thanks for working on it.

Some minor comments:

Please do not revert the comment change in xlogrecord.h.  It is not
wrong.  The exceptions mentioned are values 252-255, so "a few" is
better than "a couple".

In IsTopTransactionIdLogPending(), I suggest to reorder the tests so
that the faster ones are first -- or at least, the last one should be at
the top, so in some cases we can return without additional function
calls.  I don't think it'd be extremely noticeable, but as Tom likes to
say, a cycle shaved is a cycle earned.

XLogRecordAssemble's comment should explain its new output argument.
Maybe "*topxid_included is set if the topmost transaction ID is logged
with the current subtransaction".

I think these new routines IsTopTransactionIdLogPending and
MarkTopTransactionIdLogged should not be at the end of the file; a
location closer to where MarkCurrentTransactionIdLoggedIfAny() seems
more appropriate.  Keep related things closer.  (In this case these are
operating on TransactionStateData, and it looks right that they would
appear somewhat about AssignTransactionId and
GetStableLatestTransactionId.)

Does MarkTopTransactionIdLogged() have to be inside XLogInsertRecord's
critical section?

The names IsTopTransactionIdLogPending() and
MarkTopTransactionIdLogged() irk me somewhat.  It's not at all obvious
from these names that these routines are mostly about actions taken for
a subtransaction.  I propose IsSubxactTopXidLogPending() and
MarkSubxactTopXidLogged().  I don't feel the need to expand "Xid" to
"TransactionId" in these function names.

In TransactionStateData, I propose this wording for the comment:

    bool       topXidLogged;	/* for a subxact: is top-level XID logged? */

Thanks!

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Cuando mañana llegue pelearemos segun lo que mañana exija" (Mowgli)





view thread (30+ messages)  latest in thread

Message-ID: <202110201339.vrrwchc7jkwo@alvherre.pgsql>
Permalink:  ../202110201339.vrrwchc7jkwo@alvherre.pgsql/
Also on:    postgresql.org/message-id/202110201339.vrrwchc7jkwo@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, amit.kapila16@gmail.com, dilipbalaut@gmail.com, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better
  In-Reply-To: <202110201339.vrrwchc7jkwo@alvherre.pgsql>
  References: <CAA4eK1J3gC_hQ-CgSF8EVp6K945gNd1zuX0QxDnqyxpWw=_wsQ@mail.gmail.com> <202110201339.vrrwchc7jkwo@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox