Re: Avoid streaming the transaction which are skipped (in corner cases)

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-28T09:49:13Z
Lists: pgsql-hackers
On Mon, Nov 28, 2022 at 1:46 PM shiy.fnst@fujitsu.com
<shiy.fnst@fujitsu.com> wrote:
>
> Thanks for your patch.
>
> I saw that the patch added a check when selecting largest transaction, but in
> addition to ReorderBufferCheckMemoryLimit(), the transaction can also be
> streamed in ReorderBufferProcessPartialChange(). Should we add the check in
> this function, too?
>
> diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
> index 9a58c4bfb9..108737b02f 100644
> --- a/src/backend/replication/logical/reorderbuffer.c
> +++ b/src/backend/replication/logical/reorderbuffer.c
> @@ -768,7 +768,8 @@ ReorderBufferProcessPartialChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
>          */
>         if (ReorderBufferCanStartStreaming(rb) &&
>                 !(rbtxn_has_partial_change(toptxn)) &&
> -               rbtxn_is_serialized(txn))
> +               rbtxn_is_serialized(txn) &&
> +               rbtxn_has_streamable_change(txn))
>                 ReorderBufferStreamTXN(rb, toptxn);
>  }

You are right we need this in ReorderBufferProcessPartialChange() as
well.  I will fix this in the next version.

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



Commits

  1. Avoid unnecessary streaming of transactions during logical replication.

  2. Fix assertion failures while processing NEW_CID record in logical decoding.