Re: pgsql: Document XLOG_INCLUDE_XID a little better

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, 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 10:47:26
Message-ID: CAA4eK1J3gC_hQ-CgSF8EVp6K945gNd1zuX0QxDnqyxpWw=_wsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Oct 20, 2021 at 10:25 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> On Mon, Oct 18, 2021 at 10:48 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> >
> > Today, I have looked at this patch again and slightly changed a
> > comment, one of the function name and variable name. Do, let me know
> > if you or others have any suggestions for better names or otherwise? I
> > think we should backpatch this to 14 as well where this code was
> > introduced.
> >
>
> bool
> -IsSubTransactionAssignmentPending(void)
> +IsTopTransactionIdLogged(void)
> {
> /* wal_level has to be logical */
> if (!XLogLogicalInfoActive())
> @@ -6131,19 +6131,20 @@ IsSubTransactionAssignmentPending(void)
> if (!TransactionIdIsValid(GetCurrentTransactionIdIfAny()))
> return false;
>
> - /* and it should not be already 'assigned' */
> - return !CurrentTransactionState->assigned;
> + /* and it should not be already 'logged' */
> + return !CurrentTransactionState->topXidLogged;
> }
>
> I have one comment here, basically, you have changed the function name
> to "IsTopTransactionIdLogged", but it still behaves like
> IsTopTransactionIdLogPending. Now with the new name, it should return
> (CurrentTransactionState->topXidLogged) instead of
> (!CurrentTransactionState->topXidLogged).
>

Valid point but I think the change suggested by you won't be
sufficient. We also need to change all the other checks in that
function to return true which will make it a bit awkward. So instead,
we can change the function name to IsTopTransactionIdLogPending().
Does that make sense?

--
With Regards,
Amit Kapila.

Attachment Content-Type Size
v4-0001-Replace-XLOG_INCLUDE_XID-flag-with-a-more-localiz.patch application/octet-stream 10.5 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-10-20 10:53:26 Re: pgsql: Refactor the sslfiles Makefile target for ease of use
Previous Message Alvaro Herrera 2021-10-20 10:02:30 Re: pgsql: Ensure correct lock level is used in ALTER ... RENAME

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-10-20 10:55:20 Re: [PATCH] Fix memory corruption in pg_shdepend.c
Previous Message Amit Kapila 2021-10-20 10:19:46 Re: Data is copied twice when specifying both child and parent table in publication