Re: Synchronizing slots from primary to standby

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: "shveta(dot)malik(at)gmail(dot)com" <shveta(dot)malik(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Synchronizing slots from primary to standby
Date: 2024-02-07 08:40:54
Message-ID: CAA4eK1KCA17eBvXndov9C5nheXqXfqEkJ_o3tUdhmz-EQjZT4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 5, 2024 at 9:19 AM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Thursday, February 1, 2024 12:20 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Thu, Feb 1, 2024 at 8:15 AM Euler Taveira <euler(at)eulerto(dot)com> wrote:
> > >
> > >
> > > While working on another patch I noticed a new NOTICE message:
> > >
> > > NOTICE: changed the failover state of replication slot "foo" on publisher to
> > false
> > >
> > > I wasn't paying much attention to this thread then I start reading the 2
> > > patches that was recently committed. The message above surprises me
> > because
> > > pg_createsubscriber starts to emit this message. The reason is that it doesn't
> > > create the replication slot during the CREATE SUBSCRIPTION. Instead, it
> > creates
> > > the replication slot with failover = false and no such option is informed
> > > during CREATE SUBSCRIPTION which means it uses the default value (failover
> > =
> > > false). I expect that I don't see any message because it is *not* changing the
> > > behavior. I was wrong. It doesn't check the failover state on publisher, it
> > > just executes walrcv_alter_slot() and emits a message.
> > >
> > > IMO if we are changing an outstanding property on node A from node B,
> > node B
> > > already knows (or might know) about that behavior change (because it is
> > sending
> > > the command), however, node A doesn't (unless log_replication_commands
> > = on --
> > > it is not the default).
> > >
> > > Do we really need this message as NOTICE?
> > >
> >
> > The reason for adding this NOTICE was to keep it similar to other
> > Notice messages in these commands like create/drop slot. However, here
> > the difference is we may not have altered the slot as the property is
> > already the same as we want to set on the publisher. So, I am not sure
> > whether we should follow the existing behavior or just get rid of it.
> > And then do we remove similar NOTICE in AlterSubscription() as well?
> > Normally, I think NOTICE intends to let users know if we did anything
> > with slots while executing subscription commands. Does anyone else
> > have an opinion on this point?
> >
> > A related point, I think we can avoid setting the 'failover' property
> > in ReplicationSlotAlter() if it is not changed, the advantage is we
> > will avoid saving slots. OTOH, this won't be a frequent operation so
> > we can leave it as it is as well.
>
> Here is a patch to remove the NOTICE and improve the ReplicationSlotAlter.
> The patch also includes few cleanups based on Peter's feedback.
>

Thanks for the patch. Pushed.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-02-07 08:56:58 Re: Possibility to disable `ALTER SYSTEM`
Previous Message Amit Kapila 2024-02-07 08:38:42 Re: Is this a problem in GenericXLogFinish()?