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

Shubham Khanna <khannashubham1197@gmail.com>

From: Shubham Khanna <khannashubham1197@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-12-11T10:05:32Z
Lists: pgsql-hackers

Attachments

On Wed, Dec 11, 2024 at 2:08 PM vignesh C <vignesh21@gmail.com> wrote:
>
> On Wed, 11 Dec 2024 at 11:21, Shubham Khanna
> <khannashubham1197@gmail.com> wrote:
> >
> > On Wed, Dec 11, 2024 at 4:21 AM Peter Smith <smithpb2250@gmail.com> wrote:
> >
> > I have fixed the given comments. The attached patch contains the
> > suggested changes.
>
> Since all the subscriptions are created based on the two_phase option
> provided, there is no need to store this for each database:
> @@ -53,6 +54,7 @@ struct LogicalRepInfo
>         char       *pubname;            /* publication name */
>         char       *subname;            /* subscription name */
>         char       *replslotname;       /* replication slot name */
> +       bool            two_phase;              /* two-phase enabled
> for the subscription */
>
>                 dbinfo[i].dbname = cell->val;
> +               dbinfo[i].two_phase = opt->two_phase;
>                 if (num_pubs > 0)
>
> How about we handle something like in the attached changes.
>

Thank you for pointing this out and for suggesting the changes. I
agree with your approach.
Also, I found a mistake in getopt_long and fixed it in this version of
the patch.
The attached patch contains the suggested changes.

Thanks and regards,
Shubham Khanna.

Commits

  1. Add two-phase option in pg_createsubscriber.