Re: Identify missing publications from publisher while create/alter subscription.

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Identify missing publications from publisher while create/alter subscription.
Date: 2022-03-29 14:45:25
Message-ID: CALDaNm3VdAqxks5Apn90dUrCAxBPFRaRt2u=7FLKengDrV9vnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 29, 2022 at 4:12 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Mar 29, 2022 at 11:01 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Sat, Mar 26, 2022 at 7:53 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > >
> > > The patch was not applying on HEAD, attached patch which is rebased on
> > > top of HEAD.
> > >
> >
> > IIUC, this patch provides an option that allows us to give an error if
> > while creating/altering subcsiction, user gives non-existant
> > publications. I am not sure how useful it is to add such behavior via
> > an option especially when we know that it can occur in some other ways
> > like after creating the subscription, users can independently drop
> > publication from publisher. I think it could be useful to provide
> > additional information here but it would be better if we can follow
> > Euler's suggestion [1] in the thread where he suggested issuing a
> > WARNING if the publications don't exist and document that the
> > subscription catalog can have non-existent publications.
> >
> > I think we should avoid adding new options unless they are really
> > required and useful.
> >
>
> *
> +connect_and_check_pubs(Subscription *sub, List *publications)
> +{
> + char *err;
> + WalReceiverConn *wrconn;
> +
> + /* Load the library providing us libpq calls. */
> + load_file("libpqwalreceiver", false);
> +
> + /* Try to connect to the publisher. */
> + wrconn = walrcv_connect(sub->conninfo, true, sub->name, &err);
> + if (!wrconn)
> + ereport(ERROR,
> + errcode(ERRCODE_CONNECTION_FAILURE),
> + errmsg("could not connect to the publisher: %s", err));
>
> I think it won't be a good idea to add new failure modes in existing
> commands especially if we decide to make it non-optional. I think we
> can do this check only in case we are already connecting to the
> publisher.

I have modified it to check only in create subscription/alter
subscription .. add publication and alter subscription.. set
publication cases where we are connecting to the publisher.
The changes for the same are present at v16 patch attached at [1].
[1] - https://www.postgresql.org/message-id/CALDaNm2zHd9FAn%2BMAQ3x-2%2BRnu8%3DRu%2BBeQXokfNBKo6sNAVb3A%40mail.gmail.com

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-03-29 15:02:04 Re: Add header support to text format and matching feature
Previous Message vignesh C 2022-03-29 14:41:18 Re: Identify missing publications from publisher while create/alter subscription.