Re: replay pause vs. standby promotion - Mailing list pgsql-hackers

From Atsushi Torikoshi
Subject Re: replay pause vs. standby promotion
Date
Msg-id CACZ0uYGJ7YLRArqjwbZMdcuwMsYXZuZbGoG_EC837xz35AKbew@mail.gmail.com
Whole thread Raw
In response to Re: replay pause vs. standby promotion  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Responses Re: replay pause vs. standby promotion
List pgsql-hackers

On Fri, Mar 6, 2020 at 10:18 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:

OK, so patch attached.

This patch causes, if a promotion is triggered while recovery is paused,
the paused state to end and a promotion to continue. OTOH, this patch
makes pg_wal_replay_pause() and _resume() throw an error if it's executed
while a promotion is ongoing.  
Regarding recovery_target_action, if the recovery target is reached
while a promotion is ongoing, "pause" setting will act the same as "promote",
i.e., recovery will finish and the server will start to accept connections.

To implement the above, I added new shared varible indicating whether
a promotion is triggered or not. Only startup process can update this shared
variable. Other processes like read-only backends can check whether
promotion is ongoing, via this variable.

I added new function PromoteIsTriggered() that returns true if a promotion
is triggered. Since the name of this function and the existing function
IsPromoteTriggered() are confusingly similar, I changed the name of
IsPromoteTriggered() to IsPromoteSignaled, as more appropriate name.

I've confirmed the patch works as you described above.
And I also poked around it a little bit but found no problems.
 
Regards,

--
Atsushi Torikoshi

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Berserk Autovacuum (let's save next Mandrill)
Next
From: Andres Freund
Date:
Subject: Re: Berserk Autovacuum (let's save next Mandrill)