Re: pgsql: Document XLOG_INCLUDE_XID a little better

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better
Date: 2021-10-20 15:19:36
Message-ID: CAFiTN-vAR3oNwOB1ryqbxdVjHymKS7kyqXVMoA0ecTtPb=PMew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Oct 20, 2021 at 7:09 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> 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:

Thanks for the review, most of the comments look fine, and will work
on those, but I think some of them need more thoughts so replying to
those.

> 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.

I don't think we can really move the last at top. Basically, we only
want to log the top transaction id if all the above check passes and
the top xid is not yet logged. For example, if the WAL level is not
logical then we don't want to log the top xid even if it is not yet
logged, similarly, if the current transaction is not a subtransaction
then also we don't want to log the top transaction.

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

I think this function is doing somewhat similar things to what we are
doing in MarkCurrentTransactionIdLoggedIfAny() so put at the same
place. But I don't see any reason for this to be in the critical
section.

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-20 16:06:56 pgsql: Protect against collation variations in test
Previous Message Alvaro Herrera 2021-10-20 13:39:15 Re: pgsql: Document XLOG_INCLUDE_XID a little better

Browse pgsql-hackers by date

  From Date Subject
Next Message Stan Hu 2021-10-20 15:55:12 Re: lastOverflowedXid does not handle transaction ID wraparound
Previous Message Anna Akenteva 2021-10-20 14:53:02 Some questions about schema privileges