Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.
Date: 2025-03-20 03:36:10
Message-ID: CAHv8RjLqk07qQU_FNuyWSRCena_YYySGR6vNFAQ0kDTLmmq8Mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 19, 2025 at 3:15 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Wed, 19 Mar 2025 at 14:32, Shubham Khanna
> <khannashubham1197(at)gmail(dot)com> wrote:
> >
> >
> > Changed -r to -R based on the shared analysis to avoid conflict with
> > the --retain option used in pg_upgrade and to maintain consistency
> > across tools.
> >
> > The attached patch contains the suggested change.
>
> Few suggestions:
> 1) I felt the comments from the function header of
> check_and_drop_publications and the comments of the caller should be
> interchanged. That will help in understanding the
> check_and_drop_publications function more easily:
> + * Since the publications were created before the
> consistent LSN, they
> + * remain on the subscriber even after the physical replica is
> + * promoted. Remove these publications from the
> subscriber because
> + * they have no use. Additionally, if requested, drop
> all pre-existing
> + * publications.
> */
> - drop_publication(conn, &dbinfo[i]);
> + check_and_drop_publications(conn, &dbinfo[i]);
>
> +/*
> + * Check and drop the required publications in the given database.
> + */
> +static void
> +check_and_drop_publications(PGconn *conn, struct LogicalRepInfo *dbinfo)
>

Fixed.

> 2) I was not sure if this line "Multiple object types can be specified
> by using multiple --removed" is required in documentation, as
> currently the only option supported is publications:
> + target server. Multiple object types can be specified by using multiple
> + <option>--remove</option> switches.
> + </para>
>
> I felt this should be added once at least one more object type removal
> is included.
>

Fixed.

The attached patch contains the suggested changes.

Thanks and regards,
Shubham Khanna.

Attachment Content-Type Size
v24-0001-Support-for-dropping-all-publications-in-pg_crea.patch application/octet-stream 12.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-03-20 03:37:56 Re: Add missing tab completion for VACUUM and ANALYZE with ONLY option
Previous Message Paul Jungwirth 2025-03-20 03:33:36 Re: SQL:2011 application time