Re: Disallow changing slot's failover option in transaction block

2024-04-23 Thread Amit Kapila
On Mon, Apr 22, 2024 at 2:31 PM Bertrand Drouvot wrote: > > On Mon, Apr 22, 2024 at 11:32:14AM +0530, shveta malik wrote: > > On Mon, Apr 22, 2024 at 5:57 AM Zhijie Hou (Fujitsu) > > wrote: > > > Attach the V3 patch which also addressed Shveta[1] and Bertrand[2]'s > > > comments. > > Thanks! >

Re: Disallow changing slot's failover option in transaction block

2024-04-22 Thread Bertrand Drouvot
Hi, On Mon, Apr 22, 2024 at 11:32:14AM +0530, shveta malik wrote: > On Mon, Apr 22, 2024 at 5:57 AM Zhijie Hou (Fujitsu) > wrote: > > Attach the V3 patch which also addressed Shveta[1] and Bertrand[2]'s > > comments. Thanks! > Tested the patch, works well. Same here. Regards, -- Bertrand

Re: Disallow changing slot's failover option in transaction block

2024-04-22 Thread shveta malik
On Mon, Apr 22, 2024 at 5:57 AM Zhijie Hou (Fujitsu) wrote: > > On Friday, April 19, 2024 10:54 AM Kuroda, Hayato/黒田 隼人 > wrote: > > In your patch, the pg_dump.c was updated. IIUC the main reason was that > > pg_restore executes some queries as single transactions so that ALTER > > SUBSCRIPTION

RE: Disallow changing slot's failover option in transaction block

2024-04-21 Thread Zhijie Hou (Fujitsu)
On Friday, April 19, 2024 10:54 AM Kuroda, Hayato/黒田 隼人 wrote: > In your patch, the pg_dump.c was updated. IIUC the main reason was that > pg_restore executes some queries as single transactions so that ALTER > SUBSCRIPTION cannot be done, right? Yes, and please see below for other reasons. >

Re: Disallow changing slot's failover option in transaction block

2024-04-19 Thread shveta malik
On Fri, Apr 19, 2024 at 6:09 AM Zhijie Hou (Fujitsu) wrote: > > Here is V2 patch which includes the changes for CREATE SUBSCRIPTION as > suggested. Since we don't connect pub to alter slot when (create_slot=false) > anymore, the restriction that disallows failover=true when connect=false is >

Re: Disallow changing slot's failover option in transaction block

2024-04-19 Thread Bertrand Drouvot
Hi, On Fri, Apr 19, 2024 at 12:39:40AM +, Zhijie Hou (Fujitsu) wrote: > Here is V2 patch which includes the changes for CREATE SUBSCRIPTION as > suggested. Since we don't connect pub to alter slot when (create_slot=false) > anymore, the restriction that disallows failover=true when

RE: Disallow changing slot's failover option in transaction block

2024-04-18 Thread Hayato Kuroda (Fujitsu)
Dear Hou, Thanks for updating the patch! Let me confirm the content. In your patch, the pg_dump.c was updated. IIUC the main reason was that pg_restore executes some queries as single transactions so that ALTER SUBSCRIPTION cannot be done, right? Also, failover was synchronized only when we were

RE: Disallow changing slot's failover option in transaction block

2024-04-18 Thread Hayato Kuroda (Fujitsu)
Dear Shveta, > When I said that option 2 aligns with ALTER-SUB documented behaviour, > I meant the doc described in [1] stating "When altering the slot_name, > the failover and two_phase property values of the named slot may > differ from the counterpart failover and two_phase parameters >

RE: Disallow changing slot's failover option in transaction block

2024-04-18 Thread Zhijie Hou (Fujitsu)
On Thursday, April 18, 2024 1:52 PM Amit Kapila wrote: > > On Tue, Apr 16, 2024 at 5:06 PM shveta malik > wrote: > > > > On Tue, Apr 16, 2024 at 1:45 PM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > Dear Hou, > > > > > > > Kuroda-San reported an issue off-list that: > > > > > > > > If user

Re: Disallow changing slot's failover option in transaction block

2024-04-18 Thread Michael Paquier
On Thu, Apr 18, 2024 at 11:22:24AM +0530, Amit Kapila wrote: > +1 for option 2 as it sounds logical to me and consistent with ALTER > SUBSCRIPTION. BTW, IIUC, you are referring to: "When altering the > slot_name, the failover and two_phase property values of the named > slot may differ from the

Re: Disallow changing slot's failover option in transaction block

2024-04-18 Thread shveta malik
On Thu, Apr 18, 2024 at 11:40 AM Hayato Kuroda (Fujitsu) wrote: > > Dear Shveta, > > Sorry for delay response. I missed your post. > > > +1. > > > > Similar to ALTER SUB, CREATE SUB also needs to be fixed. This is > > because we call alter_replication_slot in CREATE SUB as well, for the > > case

RE: Disallow changing slot's failover option in transaction block

2024-04-18 Thread Hayato Kuroda (Fujitsu)
Dear Shveta, Sorry for delay response. I missed your post. > +1. > > Similar to ALTER SUB, CREATE SUB also needs to be fixed. This is > because we call alter_replication_slot in CREATE SUB as well, for the > case when slot_name is provided and create_slot=false. But the tricky > part is we call

Re: Disallow changing slot's failover option in transaction block

2024-04-18 Thread shveta malik
On Thu, Apr 18, 2024 at 11:22 AM Amit Kapila wrote: > > On Tue, Apr 16, 2024 at 5:06 PM shveta malik wrote: > > > > On Tue, Apr 16, 2024 at 1:45 PM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > Dear Hou, > > > > > > > Kuroda-San reported an issue off-list that: > > > > > > > > If user execute

Re: Disallow changing slot's failover option in transaction block

2024-04-17 Thread Amit Kapila
On Tue, Apr 16, 2024 at 5:06 PM shveta malik wrote: > > On Tue, Apr 16, 2024 at 1:45 PM Hayato Kuroda (Fujitsu) > wrote: > > > > Dear Hou, > > > > > Kuroda-San reported an issue off-list that: > > > > > > If user execute ALTER SUBSCRIPTION SET (failover) command inside a txn > > > block > > >

Re: Disallow changing slot's failover option in transaction block

2024-04-16 Thread shveta malik
On Tue, Apr 16, 2024 at 1:45 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Hou, > > > Kuroda-San reported an issue off-list that: > > > > If user execute ALTER SUBSCRIPTION SET (failover) command inside a txn block > > and rollback, only the subscription option change can be rolled back, while > >

RE: Disallow changing slot's failover option in transaction block

2024-04-16 Thread Hayato Kuroda (Fujitsu)
Dear Hou, > Kuroda-San reported an issue off-list that: > > If user execute ALTER SUBSCRIPTION SET (failover) command inside a txn block > and rollback, only the subscription option change can be rolled back, while > the > replication slot's failover change is preserved. > > This is because

Re: Disallow changing slot's failover option in transaction block

2024-04-16 Thread Bertrand Drouvot
Hi, On Tue, Apr 16, 2024 at 06:32:11AM +, Zhijie Hou (Fujitsu) wrote: > Hi, > > Kuroda-San reported an issue off-list that: > > If user execute ALTER SUBSCRIPTION SET (failover) command inside a txn block > and rollback, only the subscription option change can be rolled back, while > the >

Disallow changing slot's failover option in transaction block

2024-04-16 Thread Zhijie Hou (Fujitsu)
Hi, Kuroda-San reported an issue off-list that: If user execute ALTER SUBSCRIPTION SET (failover) command inside a txn block and rollback, only the subscription option change can be rolled back, while the replication slot's failover change is preserved. This is because ALTER SUBSCRIPTION SET