RE: logical replication empty transactions
Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
From: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Ajin Cherian <itsajin@gmail.com>, "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>, Peter Smith <smithpb2250@gmail.com>, "osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>, vignesh C <vignesh21@gmail.com>, Michael
Paquier <michael@paquier.xyz>, Rahila Syed <rahila.syed@2ndquadrant.com>, Dilip Kumar <dilipbalaut@gmail.com>, Jeff Janes <jeff.janes@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Craig Ringer <craig@2ndquadrant.com>
Date: 2022-03-29T08:35:11Z
Lists: pgsql-hackers
Attachments
- v33-0001-Skip-empty-transactions-for-logical-replication.patch (application/octet-stream) patch v33-0001
On Tuesday, March 29, 2022 3:20 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> Some comments:
Thanks for the comments!
>
> + if (skipped_xact &&
> + SyncRepRequested() &&
> + ((volatile WalSndCtlData *)
> WalSndCtl)->sync_standbys_defined)
> + {
> + WalSndKeepalive(false, ctx->write_location);
>
> I think we can use 'lsn' since it is actually ctx->write_location.
Agreed, and changed.
> ---
> + if (!sent_begin_txn)
> + {
> + elog(DEBUG1, "Skipped replication of an empty
> transaction with XID: %u", txn->xid);
> + return;
> + }
>
> The log message should start with lowercase.
Changed.
> ---
> +# Note that the current location of the log file is not grabbed
> +immediately # after reloading the configuration, but after sending one
> +SQL command to # the node so as we are sure that the reloading has taken
> effect.
> +$log_location = -s $node_subscriber->logfile;
> +
> +$node_publisher->safe_psql('postgres', "INSERT INTO tab_notrep VALUES
> +(11)");
> +
> +$node_publisher->wait_for_catchup('tap_sub');
> +
> +$logfile = slurp_file($node_publisher->logfile, $log_location);
>
> I think we should get the log location of the publisher node, not subscriber
> node.
Changed.
Attach the new version patch which addressed the
above comments and slightly adjusted some code comments.
Best regards,
Hou zj
Commits
-
Skip empty transactions for logical replication.
- d5a9d86d8ffc 15.0 landed
-
Add decoding of sequences to built-in replication
- 75b1521dae1f 15.0 cited
-
Allow specifying row filters for logical replication of tables.
- 52e4f0cd472d 15.0 cited