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

2021-08-24 Thread Masahiko Sawada
On Tue, Aug 24, 2021 at 5:38 PM Amit Kapila wrote: > > On Tue, Aug 24, 2021 at 7:13 AM Masahiko Sawada wrote: > > > > On Tue, Aug 24, 2021 at 10:01 AM houzj.f...@fujitsu.com > > wrote: > > > > > > > > > > > > > -Original Message- > > > > From: Masahiko Sawada > > > > Sent: Tuesday, Augu

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

2021-08-24 Thread Amit Kapila
On Tue, Aug 24, 2021 at 7:13 AM Masahiko Sawada wrote: > > On Tue, Aug 24, 2021 at 10:01 AM houzj.f...@fujitsu.com > wrote: > > > > > > > > > -Original Message- > > > From: Masahiko Sawada > > > Sent: Tuesday, August 24, 2021 8:52 AM > > > > > > Thanks. The patch for HEAD looks good to m

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

2021-08-23 Thread Masahiko Sawada
On Tue, Aug 24, 2021 at 10:01 AM houzj.f...@fujitsu.com wrote: > > > > > -Original Message- > > From: Masahiko Sawada > > Sent: Tuesday, August 24, 2021 8:52 AM > > > > Thanks. The patch for HEAD looks good to me. Regarding the patch for PG14, I > > think we need to update the comment as

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

2021-08-23 Thread houzj.f...@fujitsu.com
> -Original Message- > From: Masahiko Sawada > Sent: Tuesday, August 24, 2021 8:52 AM > > Thanks. The patch for HEAD looks good to me. Regarding the patch for PG14, I > think we need to update the comment as well: > > @@ -987,7 +986,7 @@ AlterSubscription(AlterSubscriptionStmt *stmt, b

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

2021-08-23 Thread Masahiko Sawada
On Mon, Aug 23, 2021 at 11:05 PM houzj.f...@fujitsu.com wrote: > > On Mon, Aug 23, 2021 8:01 PM Amit Kapila wrote: > > On Mon, Aug 23, 2021 at 2:45 PM > > houzj.f...@fujitsu.com wrote: > > > > > > On Mon, Aug 23, 2021 12:59 PM Amit Kapila wrote: > > > > > > > > On Sat, Aug 7, 2021 at 6:53 PM ho

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

2021-08-23 Thread houzj.f...@fujitsu.com
On Mon, Aug 23, 2021 8:01 PM Amit Kapila wrote: > On Mon, Aug 23, 2021 at 2:45 PM > houzj.f...@fujitsu.com wrote: > > > > On Mon, Aug 23, 2021 12:59 PM Amit Kapila wrote: > > > > > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > > > wrote: > > > > > > > > Personally, I also think it

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

2021-08-23 Thread Amit Kapila
On Mon, Aug 23, 2021 at 2:45 PM houzj.f...@fujitsu.com wrote: > > On Mon, Aug 23, 2021 12:59 PM Amit Kapila wrote: > > > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > > wrote: > > > > > > Personally, I also think it will be better to make the behavior > > > consistent. > > > Attach

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

2021-08-23 Thread houzj.f...@fujitsu.com
On Mon, Aug 23, 2021 12:59 PM Amit Kapila wrote: > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > wrote: > > > > Personally, I also think it will be better to make the behavior consistent. > > Attach the new version patch make both ADD and DROP behave the same as > > SET PUBLICATION

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

2021-08-23 Thread houzj.f...@fujitsu.com
On Mon, Aug 23, 2021 1:18 PM Masahiko Sawada wrote: > On Mon, Aug 23, 2021 at 1:59 PM Amit Kapila > wrote: > > > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > > wrote: > > > > > > Personally, I also think it will be better to make the behavior > > > consistent. > > > Attach the new

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

2021-08-22 Thread Masahiko Sawada
On Mon, Aug 23, 2021 at 1:59 PM Amit Kapila wrote: > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > wrote: > > > > Personally, I also think it will be better to make the behavior consistent. > > Attach the new version patch make both ADD and DROP behave the same as SET > > PUBLICATION

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

2021-08-22 Thread Amit Kapila
On Wed, Aug 18, 2021 at 7:54 PM Peter Eisentraut wrote: > > On 10.08.21 05:22, Amit Kapila wrote: > > Yeah, unless we change design drastically we might not be able to do a > > refresh for dropped publications, for add it is possible. It seems > > most of the people responded on this thread that w

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

2021-08-22 Thread Amit Kapila
On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com wrote: > > Personally, I also think it will be better to make the behavior consistent. > Attach the new version patch make both ADD and DROP behave the same as SET > PUBLICATION > which refresh all the publications. > I think we can have test

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

2021-08-18 Thread Peter Eisentraut
On 10.08.21 05:22, Amit Kapila wrote: Yeah, unless we change design drastically we might not be able to do a refresh for dropped publications, for add it is possible. It seems most of the people responded on this thread that we can be consistent in terms of refreshing for add/drop at this stage b

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

2021-08-09 Thread Amit Kapila
On Tue, Aug 10, 2021 at 8:05 AM Masahiko Sawada wrote: > > On Sat, Aug 7, 2021 at 2:36 PM Amit Kapila wrote: > > > > On Fri, Aug 6, 2021 at 9:57 PM Japin Li wrote: > > > > > > > > > > > Hmm yes, it cannot cover all cases. I had somehow misunderstood that > > > > the subscriber knows which relati

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

2021-08-09 Thread Masahiko Sawada
On Sat, Aug 7, 2021 at 2:36 PM Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 9:57 PM Japin Li 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 subscri

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

2021-08-09 Thread houzj.f...@fujitsu.com
On Monday, August 9, 2021 11:10 AM Amit Kapila wrote: > > On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com > wrote: > > > > On Sat, Aug 7, 2021 1:36 PM Amit Kapila wrote: > > > On Fri, Aug 6, 2021 at 9:57 PM Japin Li wrote: > > > > > > Do you mean to say that do it for both Add and Drop o

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

2021-08-08 Thread Amit Kapila
On Sat, Aug 7, 2021 at 6:53 PM houzj.f...@fujitsu.com wrote: > > On Sat, Aug 7, 2021 1:36 PM Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 9:57 PM Japin Li wrote: > > > > Do you mean to say that do it for both Add and Drop or just for Drop? > > Actually, doing it both will make the behavior cons

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

2021-08-07 Thread houzj.f...@fujitsu.com
On Sat, Aug 7, 2021 1:36 PM Amit Kapila wrote: > On Fri, Aug 6, 2021 at 9:57 PM Japin Li 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 d

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

2021-08-07 Thread Li Japin
> On Aug 7, 2021, at 1:35 PM, Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 9:57 PM Japin Li 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 d

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

2021-08-06 Thread Amit Kapila
On Fri, Aug 6, 2021 at 9:57 PM Japin Li 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 pu

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

2021-08-06 Thread Masahiko Sawada
On Fri, Aug 6, 2021 at 2:50 PM Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 10:09 AM Amit Kapila wrote: > > > > On Fri, Aug 6, 2021 at 5:09 AM Masahiko Sawada > > wrote: > > > > > > > But, isn't this happening because of your suggestion to compare the > > current set of relations with relation

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

2021-08-06 Thread Japin Li
Hi, Sorry for the late reply. Having read this thread, the problem is caused by misunderstanding the AlterSubscription_refresh(). My apologies. On Fri, 06 Aug 2021 at 14:12, Masahiko Sawada wrote: > On Fri, Aug 6, 2021 at 1:39 PM Amit Kapila wrote: >> >> On Fri, Aug 6, 2021 at 5:09 AM Masa

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

2021-08-05 Thread Masahiko Sawada
On Fri, Aug 6, 2021 at 1:39 PM Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 5:09 AM Masahiko Sawada wrote: > > > > On Thu, Aug 5, 2021 at 11:40 PM houzj.f...@fujitsu.com > > wrote: > > > > > > > To summary, I think that what we want to do in DROP SUBSCRIPTION cases > > > > is to > > > > drop r

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

2021-08-05 Thread Amit Kapila
On Fri, Aug 6, 2021 at 10:09 AM Amit Kapila wrote: > > On Fri, Aug 6, 2021 at 5:09 AM Masahiko Sawada wrote: > > > > But, isn't this happening because of your suggestion to compare the > current set of relations with relations from publications that doesn't > need to be removed? Do we have better

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

2021-08-05 Thread Amit Kapila
On Fri, Aug 6, 2021 at 5:09 AM Masahiko Sawada wrote: > > On Thu, Aug 5, 2021 at 11:40 PM houzj.f...@fujitsu.com > wrote: > > > > > To summary, I think that what we want to do in DROP SUBSCRIPTION cases is > > > to > > > drop relations from pg_subscription_rel that are no longer included in > >

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

2021-08-05 Thread Masahiko Sawada
On Thu, Aug 5, 2021 at 11:40 PM houzj.f...@fujitsu.com wrote: > > On Thursday, August 5, 2021 1:09 PM Masahiko Sawada > wrote > > I've reviewed v2 patch. Here are some comments: > > > > + if (type == ALTER_SUBSCRIPTION_SET_PUBLICATION || > > + type == ALTER_SUBSCRIPTION_R

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

2021-08-05 Thread houzj.f...@fujitsu.com
On Thursday, August 5, 2021 1:09 PM Masahiko Sawada wrote > I've reviewed v2 patch. Here are some comments: > > + if (type == ALTER_SUBSCRIPTION_SET_PUBLICATION || > + type == ALTER_SUBSCRIPTION_REFRESH) > + drop_table = !bsearch(&relid, pubrel_local_oids, >

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

2021-08-04 Thread Masahiko Sawada
On Thu, Aug 5, 2021 at 2:08 PM Masahiko Sawada wrote: > > On Wed, Aug 4, 2021 at 9:19 PM houzj.f...@fujitsu.com > wrote: > > > > On Wednesday, August 4, 2021 7:00 PM Masahiko Sawada > > wrote > > > On Wed, Aug 4, 2021 at 5:06 PM houzj.f...@fujitsu.com > > > wrote: > > > > > > > > On Wednesday

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

2021-08-04 Thread Masahiko Sawada
On Wed, Aug 4, 2021 at 9:19 PM houzj.f...@fujitsu.com wrote: > > On Wednesday, August 4, 2021 7:00 PM Masahiko Sawada > wrote > > On Wed, Aug 4, 2021 at 5:06 PM houzj.f...@fujitsu.com > > wrote: > > > > > > On Wednesday, August 4, 2021 1:47 PM Masahiko Sawada > > > > > > > > > > > I've not l

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

2021-08-04 Thread houzj.f...@fujitsu.com
On Wednesday, August 4, 2021 7:00 PM Masahiko Sawada wrote > On Wed, Aug 4, 2021 at 5:06 PM houzj.f...@fujitsu.com > wrote: > > > > On Wednesday, August 4, 2021 1:47 PM Masahiko Sawada > > > > > > I've not looked at the patch deeply yet but I think that the > > > following one line change seem

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

2021-08-04 Thread Masahiko Sawada
On Wed, Aug 4, 2021 at 5:06 PM houzj.f...@fujitsu.com wrote: > > On Wednesday, August 4, 2021 1:47 PM Masahiko Sawada > > On Mon, Aug 2, 2021 at 10:52 PM houzj.f...@fujitsu.com > > wrote: > > > > > > > > > Hi hackers, > > > > > > When testing some other logical replication related patches, I fou

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

2021-08-04 Thread houzj.f...@fujitsu.com
On Wednesday, August 4, 2021 1:47 PM Masahiko Sawada > On Mon, Aug 2, 2021 at 10:52 PM houzj.f...@fujitsu.com > wrote: > > > > > > Hi hackers, > > > > When testing some other logical replication related patches, I found > > two unexpected behaviours about ALTER SUBSCRIPTION ADD/DROP > PUBLICATION

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

2021-08-03 Thread Masahiko Sawada
Hi, On Mon, Aug 2, 2021 at 10:52 PM houzj.f...@fujitsu.com wrote: > > > Hi hackers, > > When testing some other logical replication related patches, I found two > unexpected behaviours about ALTER SUBSCRIPTION ADD/DROP PUBLICATION. > > (1) > when I execute the following sqls[1], the data of table