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

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(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>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.
Date: 2025-03-19 05:11:38
Message-ID: CAHv8RjJSr4f3zCT7DuVybDdfCBoPX10QY9z+my-zQtw1be7bJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 19, 2025 at 2:11 AM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Tue, Mar 18, 2025 at 4:47 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> I don't understand --dry-run part of conversation here. As per
>> existing code (or with the patch), we seem to be already printing the
>> publications to be dropped in dry-run mode.
>
>
> Sorry, that was me making a bad assumption rather than checking first.
>
>
> I'm still bothered by the last paragraph of the commit message saying to backup these publications when the preceding one claims strongly and unconditionally that they are redundant and serve no purpose. See my doc changes below (the docs, whatever the form, should suffice for motivating this feature and trying to explain it again in the commit message is redundant).
>

Fixed.

> #define OBJECTTYPE_PUBLICATIONS 0x1
>

Fixed.

> - SimpleStringList remove_objects; /* list of object types to remove */
> + SimpleStringList objecttypes_to_remove; /* list of object types to remove */
>

Fixed.

> - bits32 remove_objects; /* flag to remove objects on subscriber */
> +bits32 objecttypes_to_remove; /* flags indicating which object types to remove on subscriber */
>

Fixed.

> printf(_(" -r, --remove=OBJECTTYPE remove all objects of the specified type from specified\n"
> " databases on the subscriber; accepts: publications\n"));
>

Fixed.

> + * Drop the specified publication of the given database. s/of/in/ ? publication in the given database
>

Fixed.

> * Drop all publications on the database. s/on/in ? publications in the given database
>

Fixed.

> sgml:
> How about this flow?
>
> <para>
> Remove all objects of the specified type from specified databases on the
> target server. Multiple object types can be specified by using multiple
> <option>--remove</option> switches.
> </para>
> <para>
> publications: The "all tables" publications established for this subscriber are
> always removed; specifying this object type causes all other publications
> replicated from the source server to be dropped as well.
> </para>
> <para>
> The objects selected to be dropped are individually logged and do show
> up in a --dry-run. There is no opportunity to affect or stop the dropping
> of the selected objects so consider taking a backup of them using pg_dump.
> </para>
>
> Just add more paragraphs next to "publications:" as we add more object types.
>

Fixed.

The attached patch at [1] contains the suggested changes.

[1] - https://www.postgresql.org/message-id/CAHv8RjJNE1ZvWhsgL54iPsJhomhcG%2B-SGPN8AnnwdLmWt6A44A%40mail.gmail.com

Thanks and regards,
Shubham Khanna.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-03-19 05:12:38 Re: Add missing tab completion for VACUUM and ANALYZE with ONLY option
Previous Message Shubham Khanna 2025-03-19 05:08:35 Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.