Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.
Date: 2025-01-14 11:23:21
Message-ID: CANhcyEWZWs9J9pKWJO7bvruZKghxVzdjDz6M61LHxOiPwbpc9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 27 Dec 2024 at 12:06, Shubham Khanna
<khannashubham1197(at)gmail(dot)com> wrote:
>
> On Fri, Dec 27, 2024 at 11:30 AM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > > > > >
> > The documentation requires a minor update: instead of specifying
> > subscriptions, the user will specify multiple databases, and the
> > subscription will be created on the specified databases. Documentation
> > should be updated accordingly:
> > + <para>
> > + Enables <link
> > linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>
> > + commit for the subscription. If there are multiple subscriptions
> > + specified, this option applies to all of them.
> > + The default is <literal>false</literal>.
> >
>
> I have fixed the given comment. The attached patch contains the
> suggested changes.
>

Hi Shubham,

I have reviewed the v9 patch. It looks fine to me. I have tested it
and it is working as expected.
I have few comments:

1.
- pg_log_debug("subscriber(%d): subscription: %s ; connection
string: %s", i,
+ pg_log_debug("subscriber(%d): subscription: %s ; connection
string: %s, two_phase: %s", i,
dbinfo[i].subname ? dbinfo[i].subname : "(auto)",
- dbinfo[i].subconninfo);
+ dbinfo[i].subconninfo,
+ opt->two_phase ? "true" : "false");
Here the value of 'opt->two_phase' will be the same for all
subscriptions. So is it good to log it here? Thoughts?

2. In documentation pg_createsubscriber.sgml. Under Warning section,
we have following:

<application>pg_createsubscriber</application> sets up logical
replication with two-phase commit disabled. This means that any
prepared transactions will be replicated at the time
of <command>COMMIT PREPARED</command>, without advance preparation.
Once setup is complete, you can manually drop and re-create the
subscription(s) with
the <link linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>
option enabled.

I think we should update the documentation accordingly.

Thanks and Regards,
Shlok Kyal

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2025-01-14 11:26:56 Re: question about relation_open
Previous Message Michail Nikolaev 2025-01-14 11:16:22 Re: Issue with markers in isolation tester? Or not?