Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION
Date: 2021-08-10 02:35:17
Message-ID: CAD21AoCcAk0CAg+VcMvQt3yE=ciCCxm6zUu1xknKNajGDuppDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 7, 2021 at 2:36 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Aug 6, 2021 at 9:57 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >
> > >
> > > Hmm yes, it cannot cover all cases. I had somehow misunderstood that
> > > the subscriber knows which relations are associated with which
> > > publications. Given that the subscriber doesn’t know which relations
> > > are associated with which publications (and the set of subscribed
> > > relations on the subscriber becomes out of date once the publication
> > > is updated), I think it's impossible to achieve that DROP PUBLICATION
> > > drops relations that are associated with only the publication being
> > > dropped.
> > >
> > >> Do we have better ideas to fix or shall we just
> > >> say that we will refresh based on whatever current set of relations
> > >> are present in publication to be dropped?
> > >
> > > I don't have better ideas. It seems to me that it's prudent that we
> > > accept the approach in v3 patch and refresh all publications in DROP
> > > PUBLICATION cases.
> > >
> >
> > Maybe refreshing all publications in PUBLICATION cases is simple way to
> > fix the problem.
> >
>
> Actually, doing it both will make the behavior consistent but doing it
> just for Drop might be preferable by some users.

I agree that ADD/DROP PUBLICATION is convenient to just add/drop
publications instead of providing the complete publication list. But
I'm concerned that during developing this feature most people didn't
like the behavior of refreshing new and existing publications. Also,
there was pointing out that there will be an overhead of a SQL with
more publications when AlterSubscription_refresh() is called with all
the existing publications. If we feel this behavior is unnatural, the
users will feel the same. I personally think there is a benefit only
in terms of syntax. And we can work on the part of refreshing only
publications being added/dropped on v15 development. But it might be
better to consider also if there will be use cases for users to
add/remove publications in the subscription even with such downsides.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-10 03:22:13 Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION
Previous Message Tom Lane 2021-08-10 02:20:33 Re: Another regexp performance improvement: skip useless paren-captures