Re: Synchronizing slots from primary to standby

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(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-03-06 08:53:08
Message-ID: CAA4eK1Jwk1nf9wXqAyOyMGyxxfnpLOF0Zy77BZ2Wp0ZBJYzS7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 6, 2024 at 12:07 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Fri, Mar 1, 2024 at 3:22 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > On Fri, Mar 1, 2024 at 5:11 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > >
> > ...
> > > + /*
> > > + * "*" is not accepted as in that case primary will not be able to know
> > > + * for which all standbys to wait for. Even if we have physical slots
> > > + * info, there is no way to confirm whether there is any standby
> > > + * configured for the known physical slots.
> > > + */
> > > + if (strcmp(*newval, "*") == 0)
> > > + {
> > > + GUC_check_errdetail("\"*\" is not accepted for
> > > standby_slot_names");
> > > + return false;
> > > + }
> > >
> > > Why only '*' is checked aside from validate_standby_slots()? I think
> > > that the doc doesn't mention anything about '*' and '*' cannot be used
> > > as a replication slot name. So even if we don't have this check, it
> > > might be no problem.
> > >
> >
> > Hi, a while ago I asked this same question. See [1 #28] for the response..
>
> Thanks. Quoting the response from the email:
>
> SplitIdentifierString() does not give error for '*' and '*' can be considered
> as valid value which if accepted can mislead user that all the standbys's slots
> are now considered, which is not the case here. So we want to explicitly call
> out this case i.e. '*' is not accepted as valid value for standby_slot_names.
>
> IIUC we're concerned with a case like where the user confused
> standby_slot_names values with synchronous_standby_names values. Which
> means we would need to keep thath check consistent with available
> values of synchronous_standby_names.
>

Both have different formats to specify. For example, for
synchronous_standby_names we have the following kind of syntax to
specify:
[FIRST] num_sync ( standby_name [, ...] )
ANY num_sync ( standby_name [, ...] )
standby_name [, ...]

I don't think we can have a common check for both of them as the
specifications are different. In fact, I don't think we need a special
check for '*'. The user will anyway get a WARNING at a later point
that the replication slot with that name doesn't exist.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2024-03-06 08:57:44 Re: Infinite loop in XLogPageRead() on standby
Previous Message Peter Eisentraut 2024-03-06 08:51:08 Re: MERGE ... RETURNING