Re: allow online change primary_conninfo

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, "david(at)pgmasters(dot)net" <david(at)pgmasters(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: allow online change primary_conninfo
Date: 2020-03-26 00:08:12
Message-ID: 20200326000812.GA18798@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Mar-24, Alvaro Herrera wrote:

> I think the startup sighup handler should be in startup.c, not xlog.c,
> which has enough random code already. We can add an accessor in xlog.c
> to let changing the walrcv status flag, to be called from the signal
> handler.

... as in the attached version.

Sergei included LOG messages to indicate which setting has been changed.
I put these in "#if 0" for now, but I'm thinking to remove these
altogether; we already have LOG messages when a setting changes value,
per ProcessConfigFileInternal(); the log sequence looks like this, taken
from tmp_check/log/001_stream_rep_standby_2.log after running the tests:

2020-03-25 20:54:19.413 -03 [17493] LOG: received SIGHUP, reloading configuration files
2020-03-25 20:54:19.415 -03 [17493] LOG: parameter "primary_slot_name" changed to "standby_2"
2020-03-25 20:54:19.415 -03 [17493] LOG: parameter "wal_receiver_status_interval" changed to "1"
2020-03-25 20:54:19.422 -03 [17569] LOG: started streaming WAL from primary at 0/3000000 on timeline 1
2020-03-25 20:54:19.426 -03 [17494] LOG: wal receiver process shutdown requested
2020-03-25 20:54:19.426 -03 [17569] FATAL: terminating walreceiver process due to administrator command
2020-03-25 20:54:19.433 -03 [17572] LOG: started streaming WAL from primary at 0/3000000 on timeline 1

which looks sufficient. Maybe we can reword that new message, say "wal
receiver process shutdown forced by parameter change". Not sure if we
can or should adjust the FATAL line; probably not worth the trouble.

Thoughts welcome. I'm thinking on getting this applied shortly.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v10-0001-Set-wal_receiver_create_temp_slot-PGC_POSTMASTER.patch text/x-diff 10.2 KB
v10-0002-Allow-changing-primary_conninfo-and-primary_slot.patch text/x-diff 15.6 KB
v10-0003-Set-wal_receiver_create_temp_slot-as-PGC_SIGHUP.patch text/x-diff 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2020-03-26 00:16:05 Re: AllocSetEstimateChunkSpace()
Previous Message Tom Lane 2020-03-25 23:50:08 Re: plan cache overhead on plpgsql expression