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

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
Cc: "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>, "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-18 11:47:25
Message-ID: CAA4eK1LT=03FUoLew8qvTay+xzmvO-gAMsh+kvMBVd6+yqi3kQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 18, 2025 at 4:01 PM Shubham Khanna
<khannashubham1197(at)gmail(dot)com> wrote:
>
> On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> >
>
> > It would be good if we could get this to play nicely with —dry-run; maybe connecting to the source for the queries instead of the target. That would help alleviate my issue with the current auto-drop behavior.
> >
>
...
> IIUC, for testing with --dry-run, we can directly check the relevant
> stdout logs (e.g., "dropping publication 'test_pub1' ...") to verify
> the call without actually dropping the publications.
> However, IMO, using --dry-run alone would miss code coverage for the
> actual drop publication execution part.
>

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.

*
- drop_publication(conn, &dbinfo[i]);
+ if (dbinfos.remove_objects & OBJECT_PUBLICATIONS)
+ drop_all_publications(conn, &dbinfo[i]);
+ else
+ drop_publication(conn, &dbinfo[i], dbinfo[i].pubname);

I was expecting a call like the existing function
check_and_drop_existing_subscriptions(). The new function should check
if the user requested to remove the publication then it should query
the publisher, otherwise, just remove the one specified by dbinfo.
Also, the core drop_publication() function should take the required
parameters instead of dbinfo after this patch. That would simplify the
code.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-03-18 11:48:32 Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Previous Message Ilia Evdokimov 2025-03-18 11:46:11 Re: Proposal - Allow extensions to set a Plan Identifier