Re: Add macros for ReorderBufferTXN toptxn - Mailing list pgsql-hackers

From Peter Smith
Subject Re: Add macros for ReorderBufferTXN toptxn
Date
Msg-id CAHut+PsDvFvwBiSzB0bCZgMwDUfOD4dackL0ZcTHXtLuewdobA@mail.gmail.com
Whole thread Raw
In response to Re: Add macros for ReorderBufferTXN toptxn  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Add macros for ReorderBufferTXN toptxn
Re: Add macros for ReorderBufferTXN toptxn
List pgsql-hackers
On Wed, Mar 15, 2023 at 4:55 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> Hi,
>
...
> +1 to the idea. Here are some minor comments:
>
> @@ -1667,7 +1658,7 @@ ReorderBufferTruncateTXN(ReorderBuffer *rb,
> ReorderBufferTXN *txn, bool txn_prep
>   * about the toplevel xact (we send the XID in all messages), but we never
>   * stream XIDs of empty subxacts.
>   */
> - if ((!txn_prepared) && ((!txn->toptxn) || (txn->nentries_mem != 0)))
> + if ((!txn_prepared) && (rbtxn_is_toptxn(txn) || (txn->nentries_mem != 0)))
>   txn->txn_flags |= RBTXN_IS_STREAMED;
>
> Probably the following comment of the above lines also needs to be updated?
>
>      * The toplevel transaction, identified by (toptxn==NULL), is marked as
>      * streamed always,
>
> ---
> +/* Is this a top-level transaction? */
> +#define rbtxn_is_toptxn(txn)\
> +(\
> + (txn)->toptxn == NULL\
> +)
> +
> +/* Is this a subtransaction? */
> +#define rbtxn_is_subtxn(txn)\
> +(\
> + (txn)->toptxn != NULL\
> +)
> +
> +/* Get the top-level transaction of this (sub)transaction. */
> +#define rbtxn_get_toptxn(txn)\
> +(\
> + rbtxn_is_subtxn(txn) ? (txn)->toptxn : (txn)\
> +)
>
> We need a whitespace before backslashes.
>

Thanks for your interest in my patch.

PSA v4 which addresses both of your review comments.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment

pgsql-hackers by date:

Previous
From: Yuya Watari
Date:
Subject: Re: Making empty Bitmapsets always be NULL
Next
From: Kyotaro Horiguchi
Date:
Subject: "current directory" in a server error message