public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bharath Rupireddy <[email protected]>
To: Peter Smith <[email protected]>
Cc: Masahiko Sawada <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Add macros for ReorderBufferTXN toptxn
Date: Thu, 16 Mar 2023 10:40:05 +0530
Message-ID: <CALj2ACUUEXUaF8PeVMNWei=C9W3p7etiGxCFV_mmOtm0KmcF_w@mail.gmail.com> (raw)
In-Reply-To: <CAHut+PsDvFvwBiSzB0bCZgMwDUfOD4dackL0ZcTHXtLuewdobA@mail.gmail.com>
References: <CAHut+PuCznOyTqBQwjRUu-ibG-=KHyCv-0FTcWQtZUdR88umfg@mail.gmail.com>
	<CALDaNm1J-V06vNM1JBwP1OJgAQKWntJvfG8gf=3Kfnpm=bE-Yw@mail.gmail.com>
	<CAHut+PuRgxhk4GBK8Fm8hgDH=KLGvCjjOvcNXMapHgyN1bQfDA@mail.gmail.com>
	<CAA4eK1LGFhOsqLhZfiHOvgmzzO5MHJ7OgQMnOCbYp6A9Ks92WQ@mail.gmail.com>
	<CAHut+PtrD4xU4OPUB64ZK+DPDhfKn3zph=nDpEWUFFzUvMKo2w@mail.gmail.com>
	<CAD21AoBT+brpQxN4MvYzWmq=25ac=3QEwwJXfCfqaV9-_YZNYQ@mail.gmail.com>
	<CAHut+PsDvFvwBiSzB0bCZgMwDUfOD4dackL0ZcTHXtLuewdobA@mail.gmail.com>

On Thu, Mar 16, 2023 at 7:20 AM Peter Smith <[email protected]> wrote:
>
> PSA v4 which addresses both of your review comments.

Looks like a reasonable change to me.

A nitpick: how about using rbtxn_get_toptxn instead of an explicit
variable toptxn for single use?

1.
Change
    ReorderBufferTXN *toptxn = rbtxn_get_toptxn(txn);
    TestDecodingTxnData *txndata = toptxn->output_plugin_private;

To
    TestDecodingTxnData *txndata = rbtxn_get_toptxn(txn)->output_plugin_private;

2.
Change
        ReorderBufferTXN *toptxn = rbtxn_get_toptxn(txn);
        toptxn->txn_flags |= RBTXN_HAS_STREAMABLE_CHANGE;

To
        rbtxn_get_toptxn(txn)->txn_flags |= RBTXN_HAS_STREAMABLE_CHANGE;

3.
Change
    /*
     * Update the total size in top level as well. This is later used to
     * compute the decoding stats.
     */
    toptxn = rbtxn_get_toptxn(txn);

    if (addition)
    {
        txn->size += sz;
        rb->size += sz;

        /* Update the total size in the top transaction. */
        toptxn->total_size += sz;
    }
    else
    {
        Assert((rb->size >= sz) && (txn->size >= sz));
        txn->size -= sz;
        rb->size -= sz;

        /* Update the total size in the top transaction. */
        toptxn->total_size -= sz;
    }

To

    /*
     * Update the total size in top level as well. This is later used to
     * compute the decoding stats.
     */
    if (addition)
    {
        txn->size += sz;
        rb->size += sz;
        rbtxn_get_toptxn(txn)->total_size += sz;
    }
    else
    {
        Assert((rb->size >= sz) && (txn->size >= sz));
        txn->size -= sz;
        rb->size -= sz;
        rbtxn_get_toptxn(txn)->total_size -= sz;
    }

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






view thread (4+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Add macros for ReorderBufferTXN toptxn
  In-Reply-To: <CALj2ACUUEXUaF8PeVMNWei=C9W3p7etiGxCFV_mmOtm0KmcF_w@mail.gmail.com>

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

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