Re: allow online change primary_conninfo - Mailing list pgsql-hackers

From Andres Freund
Subject Re: allow online change primary_conninfo
Date
Msg-id 20190216035316.6q23okurzacergea@alap3.anarazel.de
Whole thread Raw
In response to Re: allow online change primary_conninfo  (Sergei Kornilov <sk@zsrv.org>)
Responses Re: allow online change primary_conninfo  (Sergei Kornilov <sk@zsrv.org>)
List pgsql-hackers
Hi,

On 2019-02-03 15:33:38 +0300, Sergei Kornilov wrote:
> +/*
> + * Actual processing SIGHUP signal
> + */
> +static void
> +ProcessWalRcvSigHup(void)
> +{
> +    ProcessConfigFile(PGC_SIGHUP);
> +
> +    /*
> +     * If primary_conninfo has been changed while walreceiver is running,
> +     * shut down walreceiver so that a new walreceiver is started and
> +     * initiates replication with the new connection information.
> +     */
> +    if (strcmp(current_conninfo, PrimaryConnInfo) != 0)
> +        ereport(FATAL,
> +                (errcode(ERRCODE_ADMIN_SHUTDOWN),
> +                 errmsg("terminating walreceiver process due to change of primary_conninfo"),
> +                 errdetail("In a moment starts streaming WAL with new configuration.")));
> +
> +    /*
> +     * And the same for primary_slot_name.
> +     */
> +    if (strcmp(current_slotname, PrimarySlotName) != 0)
> +        ereport(FATAL,
> +                (errcode(ERRCODE_ADMIN_SHUTDOWN),
> +                 errmsg("terminating walreceiver process due to change of primary_slot_name"),
> +                 errdetail("In a moment starts streaming WAL with new configuration.")));
> +
> +    XLogWalRcvSendHSFeedback(true);
> +}

I don't quite think this is the right design. IMO the startup process
should signal the walreceiver to shut down, and the wal receiver should
never look at the config. Otherwise there's chances for knowledge of
pg.conf to differ between the processes.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line
Next
From: Andres Freund
Date:
Subject: Re: Remove Deprecated Exclusive Backup Mode